AI-Powered Email Triage, Classification, and Interactive Agent - n8n Workflow

Use this complex n8n workflow to automatically triage new Gmail emails, classify them using Google Gemini and OpenAI, prioritize alerts via Telegram, and empower a conversational AI agent with custom n8n node tools for immediate actions.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Users suffering from email inbox overload who require intelligent automated sorting.

  • Developers or automation specialists looking for advanced n8n templates demonstrating LangChain AI Agents and custom tooling.

  • Teams requiring instant, AI-generated alerts for critical communications.

  • Businesses needing complex, multi-stage n8n workflow processes involving Gmail, LLMs, and external databases like Airtable.

Overview

This advanced n8n workflow functions as a comprehensive AI-driven inbox management and interaction system. It tackles email overload by performing multi-stage triage, classification, and summarization, immediately labeling emails based on urgency and category. High-priority items are processed by a dedicated summarization n8n node (using OpenAI) and escalated via Telegram alerts.

Furthermore, this n8n workflow includes a powerful, live AI Agent (The Master Email Coordinator) accessible via Telegram or Webhook. This Agent uses specific Gmail Tool n8n nodes to execute complex operations like reading, drafting, sending, deleting, and labeling emails based on conversational commands. This demonstrates the cutting-edge capability of using n8n and AI together to create responsive business automation. Implementing this n8n template greatly enhances productivity by automating routine tasks and centralizing mission-critical communication alerts.

How it Works

This n8n workflow operates on two primary, interconnected flows:

1. Automated Email Triage (Triggered by Gmail)


  1. Ingestion: The New Email n8n trigger captures a new email from Gmail. It immediately applies a temporary Processing label (via a Gmail n8n node) and sets the email details.

  2. Omni-Classification: The OmniClassifier n8n node (using Google Gemini) determines the email type (e.g., Noise/Spam, Newsletter, Client, Opportunity) and routes the flow accordingly.

  3. Category Handling: Depending on the category, the email is labeled and the Processing label is removed. Noise/Spam emails are sent for Unsubscribe (via an HTTP Request n8n node) and deletion.

  4. Newsletter Summarization: Emails classified as Newsletters are passed to the Newsletter Summarizer chain (Gemini), which extracts key points. This summary is then logged in Add Summary to Airtable and sent via Telegram.

  5. Priority Assessment: Emails requiring action (e.g., Client, Opportunity) proceed to the Priority Check chain (Gemini), which assigns High, Medium, or Low priority via the Priority Switch n8n node.

  6. High Priority Escalation: High-priority emails are passed to the Human Intervention Check (Gemini). If an alert is required, the Context & Summary Agent (using an OpenAI n8n node) generates a detailed context and summary, which is sent immediately through the Send Priority Alert Telegram n8n node.

2. Interactive AI Agent (Triggered by Telegram/Webhook)


  1. Agent Trigger: The agent flow can be initiated by the Telegram Trigger, Webhook Trigger, or Workflow Trigger n8n nodes.

  2. Input Preparation: Input data is merged by Aggregate Input and prepared by Set Agent Input.

  3. AI Execution: The core logic runs in the Master Email Coordinator LangChain Agent n8n node (using an OpenAI Chat Model) which references Postgres Memory to retain conversation history.

  4. Tool Use: The agent dynamically calls various Gmail Tool n8n nodes (e.g., Send Email (Tool), Get Labels (Tool)) to interact with Gmail, executing the user's requested email operations.

  5. Response: The IsTelegram? IF n8n node determines the original source and formats the AI response before sending it back using the Respond on Telegram n8n node or responding to the webhook.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n template: Copy the provided JSON and import it into your n8n instance via the 'New' -> 'Import from JSON' option.

  2. Credential Setup:

Gmail: Configure the Gmail credentials for the New Email n8n trigger and all associated Gmail n8n node actions (Tools, Labeling nodes). Ensure your Gmail API scope allows modifying, reading, and sending emails.
AI Credentials: Set up credentials for Google Gemini (for classification and priority) and OpenAI (for high-priority summarization and the core AI Agent).
Telegram: Configure Telegram Bot API credentials for the Telegram Trigger and all Telegram notification n8n node actions (Send Priority Alert, Respond on Telegram).
Postgres Memory: Set up a Postgres connection for the Postgres Memory n8n node to maintain the AI Agent's chat history.
* Airtable: Configure Airtable credentials for the logging of newsletter summaries.

  1. Gmail Labels: Crucially, you must create the specific Gmail labels referenced throughout the n8n workflow (e.g., 'Processing', 'High Priority', 'LabelFORNOISESPAM', 'Processed'). Note the sticky notes indicating where you might need to adjust Label IDs within the Gmail n8n node parameters.

  2. Activate: Save the n8n workflow and activate all trigger nodes (New Email, Telegram Trigger, Webhook Trigger).

Node Details

This intricate n8n workflow relies heavily on specialized n8n node types and AI components:

Gmail Trigger (New Email): The initiating n8n trigger for the automated triage path, listening for new emails.
OmniClassifier (LangChain Text Classifier): Uses the Google Gemini (OmniClassifier) n8n node to categorize the email content, guiding the subsequent flow control.
Priority Check / Human Intervention Check (LangChain Chain LLM): Utilizes Gemini models to assess email urgency and decide if immediate human alerting is necessary, showcasing complex flow control within this n8n workflow.
OpenAI Chat Model (Summary): An OpenAI n8n node used to generate concise context and action items for high-priority emails, ensuring quick human assessment.
Gmail Node (Labeling): Multiple instances (Add High Priority Label, Remove Processing Label, etc.) execute the core email management actions. Each Gmail n8n node requires specific label IDs to function correctly.
Master Email Coordinator (LangChain Agent): The central hub of the interactive component. This specialized n8n node uses the OpenAI Chat Model (Agent) and Postgres Memory to process conversational requests.
Gmail Tool Nodes: A suite of custom n8n node tools designed for the AI Agent, including Send Email (Tool), Delete Email (Tool), Mark Read (Tool), and Add Label (Tool). These define the specific Gmail actions the Agent is permitted to take.
Telegram Trigger: The dedicated n8n trigger that initiates the live AI Agent conversation flow when a user sends a message via Telegram.


  • dcb8e154-7459-4579-b7ab-dedabf984b93 (Priority Switch): A standard n8n node for flow control, routing the email based on the output of the priority AI model.

Related n8n Workflows

Paid

Nodes: 25 Nodes
Updated: December 26 2025
View all
Created by
Peter Joslyn
Peter Joslyn

Featured*