Generate IPL postโ€‘match and weekly email analyses with GPTโ€‘4o, CricAPI and Gmail

Go to Workflow
0 views
Built by Rahul Joshi Rahul Joshi
Created on June 05, 2026

Description

๐Ÿ“Š Description
The scoreboard shows you what happened. This workflow tells you why it happened. Every time an IPL match ends this automation detects the completed result, fetches the full scorecard, and sends it to GPT-4o which produces a detailed journalist-style post-match analysis โ€” innings breakdowns, tactical decisions, key turning points, player of the match, and what the result means for both teams. Every Monday it also generates a weekly roundup digest covering all the week's matches in one beautifully designed email.
Built for sports media companies, IPL fan platforms, cricket newsletters, and automation agencies who want to produce expert-level match analysis at scale without a dedicated editorial team.

What This Workflow Does
โฐ Polls CricAPI every 30 minutes for recently completed IPL matches
๐Ÿ“‹ Checks the Match Log sheet to avoid analyzing the same match twice
๐Ÿ Detects new completed IPL matches and saves them to the Match Log
๐Ÿงฎ Computes both innings run rates and builds a structured analytical prompt
๐Ÿค– Sends full match context to GPT-4o which generates a complete post-match analysis
๐Ÿ“ง Assembles the analysis into a branded HTML email and sends it immediately after the match
๐Ÿ“ Logs every analysis to the Analysis Log sheet with match name, winner, and player of match
๐Ÿ“Š Every Monday reads all analyses from the past 7 days and generates a weekly roundup
๐Ÿค– GPT-4o writes the weekly digest with match recaps, player of the week, and next week preview
๐Ÿ“ง Sends the weekly roundup as a branded HTML email every Monday at 9AM

Key Benefits
โœ… Fully automatic โ€” detects match completion and triggers analysis without manual input
โœ… Duplicate prevention โ€” never analyzes the same match twice
โœ… GPT-4o writes like a cricket journalist not a data report
โœ… Two email formats โ€” immediate post-match deep dive and weekly roundup digest
โœ… Complete audit trail across two Google Sheets
โœ… Falls back to any completed T20 when IPL is off-season so testing always works
โœ… Clean termination on both IF nodes โ€” no dangling branches

How It Works

SW1 โ€” Match Completion Detector Every 30 minutes the workflow fetches all current and recent matches from CricAPI and reads the Match Log sheet. The Code node filters for completed IPL T20 matches by checking that the match name contains IPL or Indian Premier League, the match type is T20, and both matchStarted and matchEnded are true. It then compares every completed match against the set of already-analyzed match IDs in the Match Log. If a new unanalyzed match is found it gets saved to the Match Log with analyzed set to false and all scorecard data flows forward into the analysis engine. If no new match is found an IF node stops the workflow cleanly.

SW2 โ€” Deep Dive Analyzer The match data flows directly from SW1 into the analysis prompt builder. The Code node computes run rates for both innings and assembles a structured prompt containing both innings stats, the match result, and clear instructions for GPT-4o to act as a cricket journalist. GPT-4o returns a headline, 3-4 sentence match summary, separate tactical breakdowns for each innings, three key moments that decided the match, an overall tactical assessment, player of the match with reasoning, and a one-sentence forward-looking note. The response is parsed and assembled into a branded HTML email with a dark blue header, score display, color-coded analysis sections, and a player of the match spotlight. The email is sent immediately and both Google Sheets are updated to record that this match has been analyzed and the email has been sent.

SW3 โ€” Weekly Digest Every Monday at 9AM the workflow reads all rows from the Analysis Log and filters for entries from the past 7 days. If matches exist GPT-4o generates a weekly roundup covering the week's headline, individual one-liner recaps for each match, player of the week, the biggest talking point or controversy, and a preview of the upcoming week. The response is assembled into a branded weekly roundup email and sent. If no matches were analyzed in the past 7 days the workflow stops cleanly without sending a blank email.

Features
30-minute polling for match completion detection
Dynamic IPL match filtering โ€” no hardcoded IDs
Duplicate prevention via Match Log sheet lookup
Both innings run rate computation
GPT-4o post-match analysis with 8 structured output fields
Immediate post-match email delivery
Weekly Monday digest with recaps, POTW, talking point, and preview
Two branded HTML email templates with dark blue cricket theme
Two Google Sheets for match tracking and analysis history
IF nodes with No Operation fallbacks on both SW1 and SW3
Fallback to any completed T20 for off-season testing

Requirements
CricAPI account and API key โ€” free tier at cricapi.com
OpenAI API key (GPT-4o access)
Google Sheets OAuth2 connection
Gmail OAuth2 connection

Setup Steps
Sign up at cricapi.com and get your free API key
Create a Google Sheet called "IPL Post Match Analyzer" with 2 sheets โ€” Match Log and Analysis Log
Add the correct column headers to both sheets.
Paste your Sheet ID into all Google Sheets nodes
Connect Google Sheets OAuth2 credentials
Add your OpenAI API key to both OpenAI nodes
Add your Gmail OAuth2 credentials and set your email in both Gmail nodes
Activate the workflow โ€” the system runs itself from here

Target Audience
๐Ÿ“บ Sports media companies automating post-match editorial content
๐Ÿ IPL cricket newsletters and fan platforms delivering expert analysis
๐Ÿค– Automation agencies building cricket intelligence products for media and franchise clients
๐Ÿ“ฑ Fan apps that want to surface match analysis without hiring a commentary team

Nodes Used (5)

Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
Google Sheets
n8n-nodes-base.googleSheets
HTTP Request
n8n-nodes-base.httpRequest
OpenAI
@n8n/n8n-nodes-langchain.openAi