Skip to main content

Classify Gmail emails with GPT-4o mini and send Telegram notifications

Workflow preview

Workflow preview
100%
Classify Gmail emails with GPT-4o mini and send Telegram notifications preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Gmail AI Email Classifier & Notifier Since Gmail inboxes can quickly become cluttered, this workflow provides an automated AI based email classification system . It listens for new emails, categori...

Best for

  • AI Summarization automation workflows
  • Multimodal AI automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.gmailtrigger, @n8n/n8n-nodes-langchain.textclassifier, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.telegram, n8n-nodes-base.gmail, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.lmchatopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Christian Moises.

Original n8n.io source

1.1 Workflow description

Title
Classify Gmail emails with GPT-4o mini and send Telegram notifications
Workflow name
Classify Gmail emails with GPT-4o mini and send Telegram notifications

Gmail AI Email Classifier & Notifier

Since Gmail inboxes can quickly become cluttered, this workflow provides an automated AI-based email classification system. It listens for new emails, categorizes them using an AI classifier, applies Gmail labels, and sends you a Telegram notification with a quick summary.

If you often miss urgent client messages or struggle with sorting work vs. promotions, this workflow ensures you never overlook important emails.

Use case: Especially useful for professionals who receive a high volume of mixed emails (clients, work, promotions). The workflow automatically labels and notifies you of new emails based on their category.


How It Works

  1. Trigger Input

    • The workflow starts with the Gmail Trigger node, which listens for new incoming emails.
    • By default, it polls every minute, but you can adjust the polling frequency.
    • Email metadata (from, subject, body) is passed downstream.

    Example JSON input:

    {
      "from": "[email protected]",
      "subject": "Urgent project deadline",
      "text": "Please review the attached contract ASAP"
    }
    
  2. Classify Email (AI)

    • The Classification Agent (powered by OpenAI via LangChain) receives the email data.

    • It sorts the email into one of four categories:

      • High Priority – urgent, time-sensitive
      • Work Related – general work emails
      • Promotions – newsletters, offers, sales
      • Other – uncategorized emails
    • The classifier uses a system prompt to ensure output is returned in JSON format for downstream processing.

  3. Apply Gmail Labels

    • Based on classification, the workflow applies the corresponding Gmail label:

      • High Priority → “Important + Starred”
      • Work Related → “Work” (custom Gmail label)
      • Promotions → “Promotions” (custom Gmail label)
    • Each label must already exist in Gmail for the operation to work.

  4. Generate Notification

    • The AI Agent (notification assistant) takes the classified email and rewrites it into a short, casual notification.

    • Example notification:

      [High Priority] New email from [email protected]  
      Subject: Urgent project deadline  
      "Please review the attached contract ASAP"
      
  5. Send to Telegram

    • The Telegram node sends the generated notification to your personal chat ID.
    • Requires a Telegram bot created with @BotFather and your chat ID configured.

How to Use

  1. Import this workflow into n8n.
  2. Set up Gmail OAuth2 credentials and connect your Gmail account.
  3. Create Gmail labels: High Priority, Work Related, Promotions.
  4. Set up a Telegram bot in @BotFather and copy your chatId into the node.
  5. Run the workflow — every new email will now be classified, labeled, and notified.

Requirements

  • n8n Gmail Trigger with Gmail OAuth2 credentials
  • OpenAI API key configured for LangChain nodes
  • Telegram bot created via @BotFather with your chat ID
  • Existing Gmail labels (Work, Promotions, etc.)

Customizing This Workflow

You can extend it by:

  • Adding more categories – e.g., “Finance,” “Personal,” or “Spam.”
  • Changing the notification channel – send to Slack, Discord, or SMS instead of Telegram.
  • Adjusting classification rules – edit the system prompt for finer-grained AI sorting.
  • Changing polling frequency – set Gmail Trigger to every 5 minutes instead of every minute.
  • Expanding extracted fields – include attachments, links, or CC addresses in the notification.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 2 - Classification Agent

Type / Role
@n8n/n8n-nodes-langchain.textClassifier - textClassifier
Config choices
Version 1

Block 3 - AI Agent1

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 4 - Send a text message

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 5 - High Priority

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 6 - Work Related

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 7 - Promotions

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 8 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - 4o-mini

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 11 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - 4o- mini

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 13 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Classify Gmail emails with GPT-4o mini and send Telegram notifications
Complexity intermediate
Nodes 13
Categories AI Summarization, Multimodal AI
Author Christian Moises
Published 18 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7553/7553.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Classify Gmail emails with GPT-4o mini and send Telegram notifications do?

Gmail AI Email Classifier & Notifier Since Gmail inboxes can quickly become cluttered, this workflow provides an automated AI based email classification system . It listens for new emails, categori...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your AI Summarization, Multimodal AI use case.