AI-Powered Gmail Classification, Labeling, and Telegram Notification - n8n Workflow

Use this powerful n8n workflow to automatically classify incoming Gmail emails using GPT-4o mini, apply specific labels (High Priority, Work Related), and send summarized, instant notifications via Telegram. Start automating your inbox with n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

This n8n workflow is ideal for:

Users drowning in email who need smart prioritization.
Professionals looking for advanced n8n templates for inbox management.
Developers wanting to implement LLM-based decision-making within their n8n node structures.
Teams requiring instant, summarized alerts for critical emails delivered via Telegram.

Overview

Managing a high volume of email can be exhausting, leading to missed deadlines or ignored high-priority messages. This advanced n8n workflow solves this problem by integrating a powerful AI classification system directly into your inbox management routine.

Starting with an n8n trigger listening to Gmail, the email content is instantly analyzed using a specialized LangChain Text Classifier (powered by GPT-4o mini). Based on predefined criteria (High Priority, Work Related, Promotion), the appropriate label is applied to the original message in Gmail. Simultaneously, a dedicated AI Agent generates a concise, casual summary of the email, which is then immediately delivered to you via a Telegram n8n node. This approach ensures critical messages are labeled correctly in Gmail and summarized for quick review on your mobile device, making this one of the most effective n8n templates for productivity.

How it Works

This powerful n8n workflow executes a multi-step automation process:


  1. Inbound n8n Trigger: The process begins with the Gmail n8n trigger, which polls your inbox every minute for new emails.

  2. AI Classification: The Classification Agent (a LangChain Text Classifier n8n node using GPT-4o mini) receives the full email data (sender, subject, body). It uses a custom system prompt to classify the email into one of four categories: 'High Priority', 'Work Related', 'Promotion', or 'Other'.

  3. Conditional Labeling: Based on the classification, the flow immediately proceeds to the corresponding Gmail n8n node (High Priority, Work Related, Promotions). These nodes apply the specified custom labels (e.g., 'YELLOW_STAR', 'IMPORTANT') to the message within Gmail.

  4. Summary Generation: The data is passed to the AI Agent1 n8n node, which acts as a notification assistant. Using a predefined prompt and the GPT-4o mini model, it generates a short, casual summary of the email, including the classification category.

  5. Final Notification: The generated summary output is sent directly to your Telegram channel using the Send a text message n8n node, providing instant and actionable alerts.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON code and paste it into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. Configure Gmail Credentials: Locate the Gmail Trigger n8n node and the subsequent Gmail labeling n8n nodes (High Priority, etc.). You must connect them using valid Gmail OAuth2 credentials that grant access to your inbox.

  3. Configure OpenAI Credentials: The classification and summarization agents require connection to an LLM. Ensure you configure your OpenAI API credentials within the 4o- mini n8n nodes.

  4. Set Up Telegram: Configure the Send a text message n8n node. You will need a Telegram Bot API key (created via BotFather) for the credentials and must update the chatId parameter with your personal Telegram ID.

  5. Define Gmail Labels: As indicated in the sticky note, ensure the specific labels referenced in the High Priority, Work Related, and Promotions n8n nodes already exist in your Gmail account. If they don't, the labeling operation will fail.

  6. Activate the n8n Trigger: Set the Gmail Trigger n8n node to active and save the workflow. This n8n workflow will now run automatically.

Node Details

Gmail Trigger: This essential n8n trigger is configured to poll for new emails every minute, acting as the starting point for the entire n8n workflow.
Classification Agent (Text Classifier n8n node): Utilizes the GPT-4o mini language model to analyze the full email text and metadata. Key configuration involves a system prompt instructing it to output a JSON classification into categories like 'High Priority', 'Work Related', or 'Promotion'.
4o- mini (Language Model n8n node): Provides the necessary LLM connection (GPT-4o mini) for both the classification agent and the summarization agent, ensuring efficient and modern AI processing within this n8n template.
High Priority / Work Related / Promotions (Gmail n8n nodes): These nodes are configured with the addLabels operation, using the message ID ({{ $json.id }}) from the trigger to dynamically apply predefined Gmail labels based on the AI's classification.
AI Agent1 (Agent n8n node): This n8n node takes the classified email data and generates a user-friendly, concise notification summary using a custom prompt: "You are a notification assistant..."
Send a text message (Telegram n8n node): The final action n8n node. It sends the summarized notification ({{ $json.output }}) to a designated chat ID, ensuring timely alerts.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

I value my time. so I created an Automation for 4 hours to save 20 minutes. I'll post all my works so you'd save that 20 minutes without spending 4 hours to create it. lol.

Featured*