Use this powerful n8n workflow to classify and auto-label your incoming Gmail messages. It uses an AI Agent and Gmail tools to check for prior conversation history, ensuring accurate categorization (Marketing, Notification, To Respond) using specific n8n templates.
Download this n8n workflow template and start using it instantly.
Overwhelmed Email Users: Individuals receiving hundreds of emails daily who need better organization.
Automation Specialists: Users seeking advanced examples of using the n8n AI Agent node with custom tools.
Technical Users: Those needing to implement sophisticated email routing logic using a robust n8n workflow.
n8n Users: Anyone looking for high-value n8n templates focusing on productivity and AI integration.
Managing a high volume of email is a major productivity drain. Standard filtering often fails to capture the nuance needed to distinguish between a critical service 'Notification', a 'To Respond' actionable item, and general 'Marketing' junk. This n8n workflow solves this by integrating advanced AI capabilities directly into your email management process.
This sophisticated n8n workflow utilizes an AI Agent configured with specific context and tools to analyze the email content, subject, and crucial header information. Critically, the AI Agent is empowered by the Gmail Tool n8n node to check for prior correspondence history with the sender, allowing it to accurately determine if an email is a cold pitch or part of an existing conversation. This context-aware classification ensures highly accurate labeling, saving significant time by ensuring that only truly actionable emails land in your priority folders. This specific n8n template provides a robust and customizable starting point for intelligent email filtering.
This n8n workflow operates entirely in the background, performing the following sequence of operations:
Gmail Trigger n8n node, which constantly polls your inbox for new incoming messages.Gmail n8n node uses the message ID to retrieve the complete email content, including all headers, plain text body, and recipient details.AI Agent n8n node. This agent is configured with the Anthropic Chat Model (using Claude) and a detailed system prompt outlining classification rules (To Respond, FYI, Notification, Marketing, etc.) and their corresponding Gmail Label IDs.Get Email and Check Sent) to determine if there is any existing email history between the user and the sender. This step is vital for correctly classifying cold outreach versus active conversations.Structured Output Parser, returns a clean JSON object containing the identified Label ID.Gmail n8n node receives the determined Label ID and uses the addLabels operation to immediately categorize the original incoming email in your Gmail account, completing the execution of the n8n workflow.To deploy this powerful n8n workflow, follow these steps:
Gmail Trigger, the initial Gmail node, and the final Gmail1 node. Ensure these credentials have full read/write access to your mailbox.Anthropic Chat Model n8n node with valid Anthropic API credentials. Ensure the account can access the specified model (Claude Sonnet 4).AI Agent n8n node. If your Gmail Label IDs differ from those defined in the prompt (e.g., Label_5151750749488724401 for 'To Respond'), update the prompt with your specific IDs.Gmail Trigger to start processing incoming emails automatically. This robust n8n template is now live. Gmail Trigger (n8n node): Functioning as the starting n8n trigger, this polls Gmail every minute for new emails that require processing. It initiates the entire n8n workflow.
Gmail (Get): Fetches the complete metadata, headers, and body content of the email identified by the n8n trigger, providing comprehensive data for the AI analysis.
Anthropic Chat Model (n8n node): Serves as the Large Language Model backbone for the AI Agent, utilizing the 'claude-sonnet-4-20250514' model to perform the classification task based on the detailed rules provided in the system prompt.
AI Agent (n8n node): The core orchestrator. This specialized n8n node interprets the email data, determines the best course of action (classification), and uses the integrated GmailTool nodes (Get Email, Check Sent) to gather necessary contextual information regarding prior correspondence history with the sender.
Structured Output Parser (n8n node): Ensures that the output from the AI Agent is strictly formatted as a JSON object containing the required 'label ID', making the data reliably usable by the final node in this n8n workflow.
Gmail1 (Add Labels): The final action n8n node. It executes the addLabels operation, applying the specific Gmail Label ID determined by the AI Agent back to the original message in your inbox.
Automate email handling using this powerful n8n workflow. It uses OpenAI to assess incoming emails and generate professional draft replies directly in Gmail. This n8n workflow saves hours daily.

Use this n8n workflow to deploy a LoneScale Tool MCP Server. Enable your AI agents to automatically create lists and add items using the specialized n8n trigger and $fromAI expressions.

Use this specialized n8n workflow to empower AI Agents with CRUD capabilities for Linear issues. A crucial n8n template for AI orchestration and DevOps tasks.

Use this powerful n8n workflow to search your Gmail inbox using natural language commands sent via Telegram. Leverage Gemini AI agents for query construction and summarizing results.








































