This workflow corresponds to n8n.io template #7092 — 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 →
{
"id": "j52UGeF9akxXBKRK",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Intelligent Email Classification",
"tags": [],
"nodes": [
{
"id": "9ae4ac61-98dd-425d-8ec3-85b0ad0da7c5",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-1184,
-496
],
"parameters": {
"filters": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "a1a5959c-52fa-417c-8024-1512909e9fae",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-896,
-240
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "7d84dcde-f724-4b08-88db-c463791f76ca",
"name": "High Priority Email",
"type": "n8n-nodes-base.gmail",
"position": [
-224,
-1024
],
"parameters": {
"labelIds": [
"Label_7974018348016773078"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "aaac9866-4d4b-4c88-97c7-a8d15b20837d",
"name": "Customer Support Email",
"type": "n8n-nodes-base.gmail",
"position": [
-208,
-752
],
"parameters": {
"labelIds": [
"Label_7432353852807721490"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "0f5b6666-002a-4090-94ad-dfb5f6e8247d",
"name": "Promotion Email",
"type": "n8n-nodes-base.gmail",
"position": [
-208,
-528
],
"parameters": {
"labelIds": [
"Label_7974018348016773078"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "9a886ba2-5721-4fdc-ad4e-7770803d61a6",
"name": "Finance/Billing Email",
"type": "n8n-nodes-base.gmail",
"position": [
-96,
-208
],
"parameters": {
"labelIds": [
"Label_487984775758613877"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "45f1546d-b619-42f5-a4ce-ee3bc3309886",
"name": "Random (General/Other) Email",
"type": "n8n-nodes-base.gmail",
"position": [
-240,
64
],
"parameters": {
"labelIds": [
"Label_4854753170056793401"
],
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "a0862448-5ccf-45a7-9522-d42e902ab00c",
"name": "Email Classifier",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
-992,
-560
],
"parameters": {
"options": {},
"inputText": "={{ $json.snippet }}",
"categories": {
"categories": [
{
"category": "High Priority",
"description": "Definition: Emails requiring immediate attention or action, often time-sensitive or involving urgent issues. Examples: System outages, legal alerts, executive requests, critical deadlines, crisis management."
},
{
"category": "Customer Support",
"description": "Definition: Emails related to addressing customer issues, questions, feedback, or service requests. Examples: Complaint resolution, troubleshooting help, account inquiries, service feedback."
},
{
"category": "Promotion",
"description": "Definition: Marketing or sales emails designed to promote a product, service, event, or offer. Examples: Newsletters, discounts, product launches, affiliate promotions."
},
{
"category": "Finance/Billing",
"description": "Definition: Emails involving monetary matters, budgets, transactions, invoices, or financial reporting. Examples: Invoices, salary slips, payment confirmations, expense reports, tax documents."
},
{
"category": "Random (General/Other)",
"description": "Definition: Emails that don\u2019t clearly fall into the above categories \u2014 often personal, spammy, or unrelated to business operations. Examples: Internal memos without urgency, jokes, general announcements, social invites."
}
]
}
},
"typeVersion": 1.1
},
{
"id": "73d29ab2-c4a7-4ad0-8082-87df29ab1a63",
"name": "Creating a Draft",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
0,
-1024
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are an Executive Assistant responsible for drafting accurate, clear, and professional responses to urgent and high-priority inquiries.\n\nHere is the incoming email you are responding to:\n{{ $('Gmail Trigger').item.json.snippet }}\n\nYour task:\n1. Read and understand the email content carefully.\n2. Identify the main issue, request, or concern.\n3. Provide a concise and effective response that directly addresses the matter.\n4. Maintain a professional and respectful tone.\n5. If additional action is needed, include a short next-steps section in the reply.\n\nOutput format (return exactly in this structure):\nSubject: [A short and relevant subject line]\nMessage: [Your full, well-formatted email reply]\n"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "e062bfb5-9e68-461c-9064-13896f1d1986",
"name": "Draft email",
"type": "n8n-nodes-base.gmail",
"position": [
400,
-1024
],
"parameters": {
"message": "={{ $json.message.content.Message }}",
"options": {},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "bff31bfe-2dfe-4cca-ae8c-442c840c5497",
"name": "Create Email",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
16,
-752
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are an Executive Assistant responsible for drafting professional, accurate, and empathetic responses to all customer support inquiries.\n\nHere is the incoming email you are responding to:\n{{ $('Gmail Trigger').item.json.snippet }}\n\nYour task:\n1. Read and understand the customer\u2019s inquiry fully.\n2. Identify the customer's name from the email content, and address them by name at the start of the reply.\n3. Provide a clear, concise, and helpful response that answers all questions or concerns raised in the email.\n4. Maintain a polite, friendly, and professional tone throughout.\n5. Avoid unnecessary filler words; focus on solving the customer's issue efficiently.\n6. End the email with:\nBest regards,\n[YOUR_NAME]\n\n(Replace [YOUR_NAME] with the actual sender\u2019s name configured in the workflow.)\n\n"
}
]
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "953f9d91-dc32-493b-8e0f-ed3447874396",
"name": "Auto Reply",
"type": "n8n-nodes-base.gmail",
"position": [
416,
-752
],
"parameters": {
"message": "={{ $json.message.content }}",
"options": {},
"emailType": "text",
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "reply"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "0685ef61-fa4f-46a1-960f-822611e55cde",
"name": "Finance Department",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
128,
-208
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are an Executive Assistant responsible for handling finance-related inquiries and preparing concise summaries for the finance department.\n\nHere is the incoming email you are responding to:\n{{ $('Gmail Trigger').item.json.snippet }}\n\nYour task:\n1. Read and fully understand the email content.\n2. Identify the key financial topic or request (e.g., invoice, payment confirmation, budget query, expense report, tax document).\n3. Summarize the essential details clearly and accurately.\n4. Keep the summary professional and free of unnecessary information.\n5. Ensure the tone remains formal and business-appropriate.\n\nOutput format (return exactly in this structure):\nSubject: [A short and relevant subject line]\nText: [A clear and concise summary of the finance-related email]\n"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "c8997eff-cc00-4dc6-9d92-378bc2d0ba64",
"name": "Summarize Promotions",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
16,
-528
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are an Executive Assistant responsible for summarizing all incoming promotional emails.\n\nHere is the incoming email you are responding to:\n{{ $('Gmail Trigger').item.json.snippet }}\n\nYour task:\n1. Read and understand the promotional email content.\n2. Identify the key offer, product, service, event, or deal being promoted.\n3. Include important details such as:\n - Offer type (discount, launch, announcement, etc.)\n - Expiry date or deadline (if mentioned)\n - Any special conditions or requirements\n4. Exclude unnecessary or repetitive marketing language.\n5. Keep the summary clear, concise, and actionable.\n\nOutput format:\nSummary: [A short, well-structured summary of the promotional email]\n"
}
]
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "90ea2e06-083e-45ec-bd41-cbd59ce650fa",
"name": "High Priority Alert",
"type": "n8n-nodes-base.whatsApp",
"position": [
624,
-1024
],
"parameters": {
"textBody": "=High priority email Alert!!!\n{{ $('Gmail Trigger').item.json.snippet }}\n\nI have created a Draft of the replying email:\n{{ $('Creating a Draft').item.json.message.content.Message }}",
"operation": "send",
"phoneNumberId": "=",
"additionalFields": {},
"recipientPhoneNumber": "[YOUR_WHATSAPP_NUMBER]"
},
"credentials": {
"whatsAppApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "ff9a200a-90bf-49b7-8b00-acdbaf320ced",
"name": "Confirmation",
"type": "n8n-nodes-base.whatsApp",
"position": [
640,
-752
],
"parameters": {
"textBody": "=Customer Support Related Inquiries\n{{ $('Gmail Trigger').item.json.snippet }}\n\nReplied email:{{ $('Create Email').item.json.message.content }}",
"operation": "send",
"phoneNumberId": "=",
"additionalFields": {},
"recipientPhoneNumber": "[YOUR_WHATSAPP_NUMBER]"
},
"credentials": {
"whatsAppApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "f912992f-ddbf-48d7-a9dc-2115c9f0f910",
"name": "Promotional Alert",
"type": "n8n-nodes-base.whatsApp",
"position": [
416,
-528
],
"parameters": {
"textBody": "=Promotional related Email Trigger\n{{ $('Gmail Trigger').item.json.snippet }}\n\n",
"operation": "send",
"phoneNumberId": "=",
"additionalFields": {},
"recipientPhoneNumber": "[YOUR_WHATSAPP_NUMBER]"
},
"credentials": {
"whatsAppApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "1c4b6a73-c41c-41b4-ba3b-c3a8b8064181",
"name": "Finance Alert",
"type": "n8n-nodes-base.whatsApp",
"position": [
752,
-208
],
"parameters": {
"textBody": "= You received a Finance related inquires:{{ $('Gmail Trigger').item.json.snippet }}\n\nI have notified this to your finance department with this Reply email:{{ $('Finance Department').item.json.message.content.Email }}",
"operation": "send",
"phoneNumberId": "=",
"additionalFields": {},
"recipientPhoneNumber": "[YOUR_WHATSAPP_NUMBER]"
},
"credentials": {
"whatsAppApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "f8c045af-ddd7-496a-9dea-c187661c2857",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1264,
-640
],
"parameters": {
"color": 4,
"height": 352,
"content": "Starts the workflow when a new email is received in Gmail.\nEnsure you've set up Gmail credentials and appropriate filters if needed."
},
"typeVersion": 1
},
{
"id": "677541d5-fab0-4afa-bf22-62ee20aef21d",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1008,
-816
],
"parameters": {
"width": 320,
"height": 688,
"content": "Uses OpenAI to classify the incoming email into one of 5 categories:\n\nHigh Priority\n\nCustomer Support\n\nPromotion\n\nFinance/Billing\n\nRandom/General"
},
"typeVersion": 1
},
{
"id": "e0d6aa89-5dd9-4c3f-9299-94b41541b632",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-384,
-1136
],
"parameters": {
"color": 3,
"width": 1264,
"height": 272,
"content": "Adds \"High Priority\" label in Gmail\n\nGenerates a draft email using OpenAI\n\nSends a WhatsApp alert for urgent attention"
},
"typeVersion": 1
},
{
"id": "18b64002-7d5a-4ab7-9367-33891861eadb",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-384,
-848
],
"parameters": {
"color": 2,
"width": 1280,
"height": 256,
"content": "Adds \"Customer Support\" label in Gmail\n\nGenerates a quick auto-reply using OpenAI\n\nSends WhatsApp confirmation for support interaction"
},
"typeVersion": 1
},
{
"id": "2671b41b-5b64-443c-9c59-a885576de663",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-384,
-576
],
"parameters": {
"color": 5,
"width": 1296,
"height": 240,
"content": "Labels the email as \"Promotion\"\n\nSummarizes the email content using OpenAI\n\nSends a WhatsApp promotional digest alert"
},
"typeVersion": 1
},
{
"id": "5b73ffab-3eeb-4c3c-9f1b-5075fb632318",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-384,
-320
],
"parameters": {
"color": 7,
"width": 1264,
"height": 304,
"content": "Labels the email as \"Finance/Billing\"\n\nCreates a summary using OpenAI\n\nSends the summary to the Finance Department via Gmail\n\nTriggers a Finance Alert over WhatsApp"
},
"typeVersion": 1
},
{
"id": "2ed87858-1ea0-40c5-bf7c-d10819df49e1",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-384,
-48
],
"parameters": {
"color": 4,
"width": 432,
"height": 288,
"content": "Labels unclassified emails as \u201cRandom\u201d\n\nNo further automation occurs, but emails are still organized"
},
"typeVersion": 1
},
{
"id": "fd867ca9-939b-457d-b673-c01d03e9a22d",
"name": "Send to Finance Department",
"type": "n8n-nodes-base.gmail",
"position": [
528,
-208
],
"parameters": {
"sendTo": "[YOUR_GMAIL_ADDRESS]",
"message": "={{ $json.message.content.Text }}",
"options": {},
"subject": "={{ $json.message.content.Subject }}",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "c9891c26-481f-41b8-a0f2-3d1938671fc6",
"connections": {
"Auto Reply": {
"main": [
[
{
"node": "Confirmation",
"type": "main",
"index": 0
}
]
]
},
"Draft email": {
"main": [
[
{
"node": "High Priority Alert",
"type": "main",
"index": 0
}
]
]
},
"Create Email": {
"main": [
[
{
"node": "Auto Reply",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Email Classifier",
"type": "main",
"index": 0
}
]
]
},
"Promotion Email": {
"main": [
[
{
"node": "Summarize Promotions",
"type": "main",
"index": 0
}
]
]
},
"Creating a Draft": {
"main": [
[
{
"node": "Draft email",
"type": "main",
"index": 0
}
]
]
},
"Email Classifier": {
"main": [
[
{
"node": "High Priority Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Customer Support Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Promotion Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Finance/Billing Email",
"type": "main",
"index": 0
}
],
[
{
"node": "Random (General/Other) Email",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Email Classifier",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Finance Department": {
"main": [
[
{
"node": "Send to Finance Department",
"type": "main",
"index": 0
}
]
]
},
"High Priority Email": {
"main": [
[
{
"node": "Creating a Draft",
"type": "main",
"index": 0
}
]
]
},
"Summarize Promotions": {
"main": [
[
{
"node": "Promotional Alert",
"type": "main",
"index": 0
}
]
]
},
"Finance/Billing Email": {
"main": [
[
{
"node": "Finance Department",
"type": "main",
"index": 0
}
]
]
},
"Customer Support Email": {
"main": [
[
{
"node": "Create Email",
"type": "main",
"index": 0
}
]
]
},
"Send to Finance Department": {
"main": [
[
{
"node": "Finance Alert",
"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.
gmailOAuth2openAiApiwhatsAppApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
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 alerts for urgent or relevant messages. This helps ensure high-priority emails…
Source: https://n8n.io/workflows/7092/ — 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 n8n template demonstrates how to automate email classification, labeling, draft generation, and logging using Gmail, OpenAI, and Google Sheets. Use cases include customer support management, sale
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 section automates Gmail message handling through AI-powered classification and response. Using the LangChain Text Classifier, incoming emails are analyzed and sorted into four categories — High P
This workflow automatically classifies incoming Gmail messages into categories such as High Priority, Inquiry, and Finance/Billing, and then generates professional draft replies using GPT-4. By combin