Analyze Google Calendar patterns with OpenAI and send Gmail weekly digest
Needs changesWhat this workflow does
This AI workflow has 16 nodes and runs on a schedule (cron 0 7 * * 1-5) (plus 1 other trigger). Along the way it connects Google Calendar, OpenAI Chat Model and Gmail. It also calls sheets.googleapis.com over HTTP.
How it runs
Trigger: On a schedule (cron 0 7 * * 1-5) (plus 1 other trigger).
- Set Analysis Window (Edit Fields (Set)): sets 5 fields: windowDaysBack, windowDaysForward, timeMin…
- Fetch Google Calendar Events (Google Calendar): get many
- Wait: pauses before continuing
- Python - Normalize Events (Code): runs custom Python code
- Filter: keeps only the items that match a condition
- Python - Classify Events (Code): runs custom Python code
- Aggregate All Events (Merge): merges the data from its input branches
- Python - Pattern Detection Engine (Code): runs custom Python code
- AI - Generate Optimization Insights (AI Agent): runs an AI agent, with model: OpenAI Chat Model
- JS - Format Final Report (Code): runs custom JavaScript code
…plus 3 more steps. See the full node list below.
Services it uses
Other Google Sheets + Gmail templates (2,102) · Other OpenAI + Google Sheets templates (2,011) · Other OpenAI + Gmail templates (1,623)
HTTP calls to: sheets.googleapis.com
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in AI - Generate Optimization Insights (v1.6): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
Published 2026 — 6% of 2026 templates need changes for 3.0. See how template age affects 3.0 readiness →
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI - Generate Optimization Insights (v1.6) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (13)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Google Calendar
n8n-nodes-base.googleCalendar - Code
n8n-nodes-base.code - Filter
n8n-nodes-base.filter - Merge
n8n-nodes-base.merge - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Gmail
n8n-nodes-base.gmail - HTTP Request
n8n-nodes-base.httpRequest - Respond to Webhook
n8n-nodes-base.respondToWebhook - Wait
n8n-nodes-base.wait
From the author
Quick Overview This workflow runs on a weekday schedule or via webhook, pulls events from Google Calendar, analyzes meeting and focus-time patterns, generates optimization advice with OpenAI, then emails a digest through Gmail and appends the results to…