Automatic Gmail message categorization with GPT-4 content analysis & labels
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 11 nodes and runs on Gmail events. Along the way it connects Gmail and OpenAI Chat Model.
How it runs
Trigger: On Gmail events.
- Get message content (Gmail): get
- Assign labels for message (Basic LLM Chain): sends a prompt to an LLM, with model: OpenAI GPT-4 Based; output parser: JSON Parser
- Set label values (Edit Fields (Set)): sets 1 field: labels
- Split Out: splits a list into separate items
- Get all labels (Gmail): work with label
- Merge: merges the data from its input branches
- Aggregate: combines items into one
- Add labels to message (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) (Gmail trigger).
Nodes used (9)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Gmail
n8n-nodes-base.gmail - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Edit Fields (Set)
n8n-nodes-base.set - Split Out
n8n-nodes-base.splitOut - Merge
n8n-nodes-base.merge - Aggregate
n8n-nodes-base.aggregate - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
From the author
Who is this for? This workflow is ideal for Gmail users and teams who receive a high volume of emails and want to streamline inbox management. It suits professionals seeking to organize messages automatically, including sales teams, project managers, support…