Use this advanced n8n workflow to automatically classify, label, and archive unread Gmail messages using the Gemini AI agent. Achieve true zero-inbox automation.
Download this n8n workflow template and start using it instantly.
Users aiming for Zero-Inbox email management.
Automation specialists looking for advanced AI Agent n8n templates.
Businesses handling high volumes of segmented email traffic (invoices, meetings, inquiries).
Individuals wanting to leverage Google Gemini for complex data classification within an n8n node structure.
This sophisticated n8n workflow solves the problem of manual email sorting and labeling. By utilizing Google Gemini as an intelligent classification agent, this n8n template goes beyond simple keyword filtering. It analyzes the subject and body of new emails and, critically, uses Gmail tool nodes to access the sender's history and previously assigned labels. This historical context allows for highly accurate, pattern-based labeling (e.g., the 80% Majority Rule Bias defined in the system message).
This entire n8n automation ensures that once an email is classified and labeled, it is automatically archived, enabling a truly automated zero-inbox system. This specialized n8n node setup requires updating Gmail Label IDs within two code nodes, making the n8n workflow fully customizable for specific organizational categories.
The n8n trigger starts the process by polling Gmail every minute for unread emails.
Check Label Existence n8n node). This prevents unnecessary processing.If Not Assigned n8n node.Email Classifier Agent (using the Gemini Chat Model) receives the email content and strict classification rules.Get Emails By Sender Email n8n tool to analyze past communication patterns and labels from that sender. If insufficient information is available, it uses the Get Emails By Label n8n tool to pull sample emails from potential categories for comparison.If not None n8n node checks if a valid category was chosen.Convert Label to Label ID) which translates the human-readable label name (e.g., "Expenses") into the specific Gmail label ID required by the API.Add label to thread n8n node applies the identified label. Finally, the Remove Inbox label from thread n8n node archives the email, completing the zero-inbox goal of this n8n automation.Gmail Trigger n8n node and the Gmail Tool nodes to read, write, and manage labels.Google Gemini Chat Model n8n node to power the AI classification agent.When clicking ‘Execute workflow’) connected to the Get Labels Info n8n node to retrieve the unique ID for each label you created (e.g., Label_1234567890).Check Label Existence n8n node and the Convert Label to Label ID n8n node. This ensures the n8n workflow correctly references your Gmail account structure.Gmail Trigger n8n node to active to start polling your inbox. Gmail Trigger: The primary n8n trigger. Configured to poll every minute specifically for unread emails, ensuring the n8n workflow only targets new items.
Check Label Existence (Code n8n node): A critical control point. It uses custom JavaScript to verify if the email thread already contains one of the AI-managed labels, allowing the n8n workflow to skip re-classification if already processed.
Email Classifier Agent (LangChain Agent): The intelligence core of this n8n template. It uses the Google Gemini Chat Model and sophisticated system prompts detailing classification rules, prioritizing the use of Gmail tools to gather context.
Get Emails By Sender Email (Gmail Tool n8n node): This node is exposed as a tool to the AI Agent. It fetches historical communication from the sender, allowing the AI to leverage pattern recognition (like the 80% rule).
Structured Output Parser: Ensures the AI agent's output is clean and strictly formatted as JSON, guaranteeing reliable data for the subsequent n8n nodes.
Convert Label to Label ID (Code n8n node): This essential mapping node translates the human-readable label output from the AI (e.g., "Inquiries") into the unique Gmail ID required for API operations.
Add label to thread (Gmail n8n node): Applies the AI-determined label.
Remove Inbox label from thread (Gmail n8n node): Archives the email by removing the "INBOX" label, fulfilling the zero-inbox requirement of this n8n workflow.
Deploy a robust, context-aware Facebook Messenger chatbot using this powerful n8n workflow. Features include intelligent message batching, AI conversation history via n8n Data Table, custom formatting, and Gemini/Groq integration.

Deploy this powerful n8n workflow template to automatically triage Gmail emails using GPT-4o AI, posting urgent tasks to Slack, and logging all activity in Google Sheets.

Automate personalized sales outreach and follow-up sequences using this advanced n8n workflow. Integrates Google Sheets, Jina.ai for web scraping, and OpenAI for dynamic content generation.

Use this smart n8n workflow to create intelligent, personalized Out of Office replies using GPT-4o-mini. It automatically filters spam, customizes responses, and tags processed emails.

Use this robust n8n workflow to automatically analyze and clean historical Gmail emails using Gemini AI classification. Delete marketing and spam emails, and receive real-time alerts via Telegram. Essential n8n templates for inbox maintenance.








































