Auto-classify Gmail emails with AI and apply labels for inbox organization
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 8 nodes and runs on Gmail events. Along the way it connects OpenRouter Chat Model and Gmail.
How it runs
Trigger: On Gmail events.
- Aggregate: combines items into one
- Merge: merges the data from its input branches
- Fetch Available Gmail Labels (Gmail): work with label
- Classify Email with AI (Basic LLM Chain): sends a prompt to an LLM, with model: OpenRouter Chat Model
- Map Label Names to IDs (Code): runs custom JavaScript code
- Apply Classification Label (Gmail): add labels
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.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (New Gmail Email Received).
Nodes used (7)
- OpenRouter Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenRouter - Aggregate
n8n-nodes-base.aggregate - Merge
n8n-nodes-base.merge - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Gmail Trigger
n8n-nodes-base.gmailTrigger - Gmail
n8n-nodes-base.gmail - Code
n8n-nodes-base.code
From the author
Who is this for? Professionals and individuals who receive high volumes of emails, those who want to automatically organize their Gmail inbox using AI classification. What problem is this workflow solving? Manual email sorting is time-consuming and…