This workflow corresponds to n8n.io template #11114 — we link there as the canonical source.
This workflow follows the Gmail → Gmail Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "65d1a63b-fcc7-4049-ac00-dfec4b86332a",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
304,
-192
],
"parameters": {
"color": 7,
"width": 304,
"height": 976,
"content": "## Label Actions\nGmail nodes \u2014 Add \"Ads\", \"Work\", \"Personal\", \"Financial\", or \"Other\" labels."
},
"typeVersion": 1
},
{
"id": "7a61d992-e66f-4320-bd76-ab64b4faa5f2",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-112,
448
],
"parameters": {
"color": 7,
"width": 272,
"height": 240,
"content": "\n\n\n\n\n\n\n\n\n## Model\nAnthropic Chat Model \u2014 language model used by classifier (model selection / credential)."
},
"typeVersion": 1
},
{
"id": "940fa5d6-27b3-4be8-a2d7-183496bbfe0a",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-128,
80
],
"parameters": {
"color": 7,
"width": 352,
"height": 352,
"content": "## Classification\nEmail Content Classifier (LangChain) \u2014 classifies message content into category labels."
},
"typeVersion": 1
},
{
"id": "c2fa4449-d8b4-4e0a-85a7-c799e0ed735c",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
176
],
"parameters": {
"color": 7,
"width": 320,
"height": 256,
"content": "## Trigger\nGmail Trigger \u2014 listens for new incoming messages."
},
"typeVersion": 1
},
{
"id": "db1d5a35-c9f8-481d-8b2a-5350179c5ee4",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1152,
-480
],
"parameters": {
"width": 656,
"height": 1072,
"content": "## How It Works\n1. Gmail Trigger\n\nContinuously monitors your Gmail inbox for new messages.\nCaptures the email\u2019s subject, body, and metadata.\nSends the extracted content to the Email Content Classifier.\n\n2. Email Content Classification\n\nThe Email Content Classifier analyzes the email content using natural language processing.\nCompares the message against predefined Gmail labels:\nAds\nWork\nPersonal\nFinancial\nOther (fallback label)\nUsers can add or rename categories to match their specific needs.\nUses context, tone, and keywords to determine the most accurate label.\n\n3. Applying Gmail Labels\nSends the classification result to the corresponding Gmail label node.\nAutomatically applies the matching Gmail label in your inbox.\nIf the classifier cannot confidently match the message, the Other label is used as a fallback.\n## Setup Steps\n1. Connect Gmail Accounts\n2. Connect your Gmail account in the Gmail Trigger and in each Gmail label node.\n3. Configure the Email Content Classifier\n4. Map the incoming Gmail message body to inputText.\n5. Ensure the classifier node has access to a language model credential (Anthropic or other).\n6. Test the Workflow\n7. Send a few sample emails to yourself to confirm that labels are correctly applied.\n8. Tweak Categories if Needed\n9. Adjust category names in the classifier node to match your Gmail labels exactly.\n## Customization\nAdd or rename categories in the classifier to reflect your specific email types.\nCreate corresponding Gmail label nodes for each new category.\nExpand or modify categories as your workflow evolves to improve organization and efficiency.\n## Use Cases\nAutomatic inbox organization and sorting.\nSeparation of work, personal, financial, and promotional emails.\nImproved productivity by making important emails easier to locate.\nCustom categorization for specialized workflows.\n## Troubleshooting Tips\nEmails not being labeled \u2192 check API permissions and message ID references.\nWrong label assigned \u2192 update classifier examples or refine category descriptions.\nClassifier not returning a category \u2192 confirm fallback category \u201cOther\u201d is configured.\nWorkflow not triggering \u2192 reconnect Gmail Trigger authentication and ensure the workflow is active.\n\n"
},
"typeVersion": 1
},
{
"id": "2ffc836e-899e-46be-818d-d0c665bae8a2",
"name": "Add \"Ads\" label to message",
"type": "n8n-nodes-base.gmail",
"position": [
400,
-96
],
"parameters": {
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "cf738400-8b42-4b16-a4f0-498eaa889389",
"name": "Add \"Work\" label to message",
"type": "n8n-nodes-base.gmail",
"position": [
400,
80
],
"parameters": {
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "7db073dd-cc2b-47ea-9686-9699d6214eec",
"name": "Add \"Personal\" label to message",
"type": "n8n-nodes-base.gmail",
"position": [
400,
256
],
"parameters": {
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "3534f2b2-b504-4f13-9652-049b13438105",
"name": "Add \"Financial\" label to message",
"type": "n8n-nodes-base.gmail",
"position": [
400,
432
],
"parameters": {
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "3aefee49-53ed-4525-a74a-91150e607168",
"name": "Add \"Other\" label to message",
"type": "n8n-nodes-base.gmail",
"position": [
400,
608
],
"parameters": {
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "5680dcb3-8583-482f-ac52-14e01edb9690",
"name": "Anthropic Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"position": [
0,
464
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-sonnet-4-5-20250929",
"cachedResultName": "Claude Sonnet 4.5"
},
"options": {}
},
"typeVersion": 1.3
},
{
"id": "b9a041fa-b5c5-48cc-b9b0-a9c5905a7aa2",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-368,
256
],
"parameters": {
"filters": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "eda9fe4a-e5b7-4c31-976c-676aa587ad71",
"name": "Email Content Classifier",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
-64,
208
],
"parameters": {
"options": {
"fallback": "other",
"systemPromptTemplate": "Please classify the text provided by the user into one of the following categories: {Advertisment Emails, Work Emails, Personal Emails, Financial Emails}, and use the provided formatting instructions below. Don't explain, and only output the json."
},
"inputText": "=**input from gmail**",
"categories": {
"categories": [
{
"category": "Advertisment Emails",
"description": "Ads"
},
{
"category": "Work Emails",
"description": "Your work inbox"
},
{
"category": "Personal Emails",
"description": "Your personal inbox"
},
{
"category": "Financial Emails",
"description": "Emails with payments to be made"
}
]
}
},
"typeVersion": 1.1
}
],
"connections": {
"Gmail Trigger": {
"main": [
[
{
"node": "Email Content Classifier",
"type": "main",
"index": 0
}
]
]
},
"Anthropic Chat Model": {
"ai_languageModel": [
[
{
"node": "Email Content Classifier",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Email Content Classifier": {
"main": [
[
{
"node": "Add \"Ads\" label to message",
"type": "main",
"index": 0
}
],
[
{
"node": "Add \"Work\" label to message",
"type": "main",
"index": 0
}
],
[
{
"node": "Add \"Personal\" label to message",
"type": "main",
"index": 0
}
],
[
{
"node": "Add \"Financial\" label to message",
"type": "main",
"index": 0
}
],
[
{
"node": "Add \"Other\" label to message",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
How It Works 1.Gmail Trigger Continuously monitors your Gmail inbox for new messages. Captures the email’s subject, body, and metadata. Sends the extracted content to the Email Content Classifier.
Source: https://n8n.io/workflows/11114/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This template can be used to automatically label your incoming Gmail messages with AI and to build a knowledge graph from the emails tagged with a specific label to brainstorm new ideas based on them.
This n8n template uses AI to automatically classify incoming Gmail messages into five categories and route them to the right people or departments. It can also reply automatically and send WhatsApp al
Detects new unread Gmail messages Extracts sender name for personalized replies Classifies the email into one of four categories Applies the correct Gmail label and either sends an auto-reply, creates
Email Automation AI-Powered Operations Internal Productivity Tools
This workflow is designed for busy professionals, productivity enthusiasts, and teams drowning in email overload. Whether you're a startup founder, operations manager, executive assistant, or team lea