Triage and label Gmail emails with OpenAI GPT-5.6 Terra
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 28 nodes and runs on Gmail events. Along the way it connects Gmail and OpenAI Chat Model.
How it runs
Trigger: On Gmail events.
- Normalize email fields (Code): runs custom JavaScript code
- Classify email with OpenAI (AI Agent): runs an AI agent, with model: OpenAI model - email classification
- Validate AI result & guardrails (Code): runs custom JavaScript code
- Route by email category (Switch): routes items into 7 branches
- Apply category: Urgent (Gmail): add labels
- Apply category: Client (Gmail): add labels
- Apply category: Prospect (Gmail): add labels
- Apply category: Finance (Gmail): add labels
- Apply category: Admin (Gmail): add labels
- Apply category: Newsletter (Gmail): add labels
…plus 16 more steps. See the full node list below.
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) (Watch unread Gmail emails).
Nodes used (9)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Code
n8n-nodes-base.code - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Switch
n8n-nodes-base.switch - Gmail
n8n-nodes-base.gmail - Merge
n8n-nodes-base.merge - If
n8n-nodes-base.if - Edit Fields (Set)
n8n-nodes-base.set
From the author
Quick overview This workflow polls Gmail for unread emails, uses an OpenAI Chat Model to classify each message by category and priority, then automatically applies the corresponding Gmail label (or moves it to spam) to keep a professional inbox organized. How…