Auto-label incoming Gmail messages with AI nodes

Add AI labels to Gmail messages With this workflow you can automatically set labels for your Gmail message according to its content. In this workflow available are 3 labels: "Partnership", "Inquiry" and "Notification". Feel free to adjust labels according to your needs. Please remember to set label names both in your Gmail account and workflow.

Workflow Structure (11 nodes)
100%
Gmail Trigger
Gmail trigger
Gmail
Get message content
Langchain.chain Llm
Assign labels for message
Set
Set label values
Gmail
Get all labels
Merge
Merge corresponding labels
Aggregate
Aggregate label IDs
Gmail
Add labels to message
Langchain.lm Chat Open Ai
OpenAI Chat
Langchain.output Parser Structured
JSON Parser
Split Out
Split out assigned labels
Node Types:
trigger
default
transform
logic
Requires credentials

Prerequisites

Required Credentials (2)

Gmail

Used by: Gmail trigger, Get message content +2 more

Docs

OpenAI

Used by: OpenAI Chat

Docs

Complexity

Complex

Advanced features used. Requires n8n experience.

Setup time: ~35 min
Score: 48/100
Conditional Logic

When to Use This Workflow

Streamline Team Communication

Automatically route notifications and updates to the right channels and people.

Reduce information overload while keeping everyone informed.

Email Automation

Automate email responses, forwarding, or organization based on rules.

Handle routine email tasks automatically and focus on what matters.

Real-time Response

React instantly when events happen - new orders, form submissions, or API calls.

Zero delay between trigger and action for time-sensitive workflows.

workflow.json
{
  "nodes": [
    {
      "id": "8141ffad-df2a-403b-a869-799c036f9733",
      "name": "Gmail trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -600,
        580
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
...

Workflow Details

Nodes
19
Trigger
Event
Source
awesome
Added
Dec 4, 2025

Need Help?

Check out the official n8n documentation for detailed guides.

Related Workflows

Gmail AI auto-responder: create draft replies to incoming emails

When I receive an Email

Gmail
Outputparserstructured
Lmchatopenai
Chainllm
12 nodesEvent
Curated

Classify lemlist replies using OpenAI and automate reply handling

Get your lemlist API key 1. Go to your lemlist account or create one [HERE](https://app.lemlist.com/create-account) 2. G...

Lemlist
Lmchatopenai
Outputparserstructured
Slack
18 nodesEvent
Curated

Extract spend details (template)

A. Get data - Set up labels in Gmail - Suggested using Gmail filters to move emails to labels automatically

Gmail
Outputparserstructured
Lmchatgooglegemini
Google-sheets
24 nodesEvent
Curated

Social Media Analysis and Automated Email Generation

Personalize here Set: - your name - your company name - your company activity, used to find a match with your leads - y...

Http-request
Lmchatopenai
Outputparserstructured
Chainllm
19 nodesEvent
Curated

Automate Sales Meeting Prep with AI & APIFY Sent To WhatsApp

1. Periodically Search For Upcoming Meetings [Read about the Scheduled Trigger](https://docs.n8n.io/integrations/builtin...

Gmail
Google-calendar
Lmchatopenai
Informationextractor
61 nodesEvent
Curated

Calendar_scheduling

Check if incoming email is about appointment We use LLM to check subject and body of the email and determine if it's an...

Gmail
Lmchatopenai
Toolworkflow
Google-calendar
21 nodesEvent
Curated