Classify Gmail emails with OpenAI and send urgent Telegram alerts
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
What this workflow does
This AI workflow has 16 nodes and runs on Gmail events. Along the way it connects Gmail, OpenAI Chat Model and Telegram.
How it runs
Trigger: On Gmail events.
- Configuration (Edit Fields (Set)): sets 4 fields: owner_email, ai_model, enable_telegram_alerts…
- Get Gmail Labels (Gmail): work with label
- Aggregate: combines items into one
- Get Full Email (Gmail): get
- Classify Email (AI Agent): runs an AI agent, with model: OpenAI Model; 2 tools (Check Sent To Sender, Search Emails From Sender); output parser: Classification Output Parser
- Map Category to Label (Edit Fields (Set)): sets 4 fields: category, confidence, reasoning…
- Has Valid Label? (If): checks a condition and branches into true / false
- Apply Gmail Label (Gmail): add labels
- Send Telegram Alert (Telegram): uses Telegram
- Is Urgent & Alerts On? (If): checks a condition and branches into true / false
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (10)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - Gmail
n8n-nodes-base.gmail - Aggregate
n8n-nodes-base.aggregate - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Gmail Tool
n8n-nodes-base.gmailTool - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - If
n8n-nodes-base.if - Telegram
n8n-nodes-base.telegram
From the author
Quick overview This workflow polls Gmail for unread messages, uses OpenAI to classify each email into one of six categories based on content and prior sender history, applies the matching Gmail label, and sends a Telegram alert when an email is classified as…