Smart Gmail auto-labeler with Gemini AI & sender history
Ready for 3.0What this workflow does
This AI workflow has 16 nodes and runs manually, when you click “Execute workflow” (plus 1 other trigger). Along the way it connects Gmail and Google Gemini Chat Model.
How it runs
Trigger: Manually, when you click “Execute workflow” (plus 1 other trigger).
- Get many messages (Gmail): get many
- Loop Over Items (Loop Over Items (Split in Batches)): loops over the items in batches
- Check Label Existence (Code): runs custom JavaScript code
- If: checks a condition and branches into true / false
- Email Classifier Agent (AI Agent): runs an AI agent, with model: Google Gemini Chat Model; 2 tools (Get Emails By Label, Get Emails By Sender Email); output parser: Structured Output Parser
- If: checks a condition and branches into true / false
- Convert Label to Label ID (Code): runs custom JavaScript code
- Add label to thread (Gmail): add labels (thread)
- Remove Inbox label from thread (Gmail): remove labels (thread)
- Get Labels Info (Gmail): work with label
Services it uses
Other Google Gemini + Gmail templates (518)
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).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (10)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - Gmail Tool
n8n-nodes-base.gmailTool - AI Agent
@n8n/n8n-nodes-langchain.agent - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Gmail
n8n-nodes-base.gmail - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Manual Trigger
n8n-nodes-base.manualTrigger
From the author
n8n Gmail AI Auto-Labeler > An intelligent n8n workflow that automatically classifies and labels Gmail emails using Google Gemini AI, keeping your inbox organized with zero manual effort. This workflow uses AI-powered classification to analyze email…