This workflow corresponds to n8n.io template #11265 — 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": "ab088a6d-d9d3-4802-ab52-68ab4f8f03b6",
"name": "High Priority1",
"type": "n8n-nodes-base.gmail",
"position": [
1584,
-3072
],
"parameters": {
"labelIds": [
"Label_2067919150642379858"
],
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "78bc3e3b-a93a-41b0-8338-13da896accc6",
"name": "Customer Support1",
"type": "n8n-nodes-base.gmail",
"position": [
1584,
-2672
],
"parameters": {
"labelIds": [
"Label_1598855517228333727"
],
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "e404fdb0-b2d9-4353-a459-f78a3df042b9",
"name": "Promotion1",
"type": "n8n-nodes-base.gmail",
"position": [
1600,
-2256
],
"parameters": {
"labelIds": [
"Label_4204277247566580564"
],
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "52392013-8f98-4896-89c3-fec1f0a68723",
"name": "Finance/Billing1",
"type": "n8n-nodes-base.gmail",
"position": [
1600,
-1888
],
"parameters": {
"labelIds": [
"Label_6542868233920128707"
],
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "2e9b9bb2-3425-469c-9847-22bf92a0cc6e",
"name": "Creating Draft1",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1808,
-3072
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "=You are an executive assistant. Your job is to respond to incoming high priority inquiries as accurately as you can.\n\nHere is the email you are responding to: {{ $('Gmail Trigger1').item.json.text }}\n\nPlease output the following parameters: \nSubject: Subject\nMessage: actual message\nEmail_Draft: This is the response to the email.\nText_Message: This is to notify the respective team over slack / telegram / teams"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.5
},
{
"id": "78e4e690-11f1-48d0-8e4b-4b9131b3c69c",
"name": "Creating Email1",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1824,
-2672
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "=You are a customer service representative. Your job is to respond to incoming customer support inquiries as accurately as you can, and if it is an inquiry you cannot handle, please refer the user to the following email: yourname@xyz.com\nHere is the email you are responding to: {{ $('Gmail Trigger1').item.json.text }}"
}
]
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.5
},
{
"id": "1d6ad4cd-1f3e-4103-bcfb-50551e9b34b8",
"name": "Draft1",
"type": "n8n-nodes-base.gmail",
"position": [
2160,
-3072
],
"parameters": {
"message": "={{ $json.message.content.Email_Draft }}",
"options": {},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "4c4ed33d-4b29-4484-b193-5551e4d8134b",
"name": "Auto Reply1",
"type": "n8n-nodes-base.gmail",
"position": [
2160,
-2672
],
"parameters": {
"message": "={{ $json.message.content }}",
"options": {},
"resource": "thread",
"threadId": "={{ $('Customer Support1').item.json.threadId }}",
"messageId": "={{ $('Customer Support1').item.json.id }}",
"operation": "reply"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "95fe3543-e9b2-473b-9352-0fd082a8b254",
"name": "Send to Finance Dept1",
"type": "n8n-nodes-base.gmail",
"position": [
2176,
-1888
],
"parameters": {
"sendTo": "={{ $('Gmail Trigger1').item.json.from.value[0].address }}",
"message": "={{ $json.message.content.Message }}",
"options": {
"appendAttribution": false
},
"subject": "={{ $json.message.content.Subject }}",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "7c7576b3-e261-403c-b19d-450ef98d2379",
"name": "Notify (1)1",
"type": "n8n-nodes-base.telegram",
"position": [
2832,
-3072
],
"parameters": {
"text": "={{ $('Creating Draft1').item.json.message.content.Text_Message }}",
"chatId": "123456789",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "2793c504-5805-416a-9475-ccefcca88403",
"name": "Notify (2)1",
"type": "n8n-nodes-base.telegram",
"position": [
2832,
-2672
],
"parameters": {
"text": "customer support query was auto replied",
"chatId": "123456789",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "2e3a1db5-6232-4320-acdb-5d322986540f",
"name": "Notify (3)1",
"type": "n8n-nodes-base.telegram",
"position": [
2624,
-2256
],
"parameters": {
"text": "Promotional email removed from the Inbox",
"chatId": "123456789",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "e5ffee10-0064-455d-a44e-620ce6f5cc28",
"name": "Notify (4)1",
"type": "n8n-nodes-base.telegram",
"position": [
2848,
-1888
],
"parameters": {
"text": "There is a billing enquiry that needs your immediate attention",
"chatId": "123456789",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "3471f590-5c53-474d-abfe-0e507c1b8885",
"name": "Gmail Trigger1",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
672,
-2448
],
"parameters": {
"simple": false,
"filters": {
"labelIds": [
"UNREAD"
]
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
},
{
"id": "1961b370-4b12-43ab-a24f-449dbd6334f0",
"name": "Get row(s) in sheet",
"type": "n8n-nodes-base.googleSheets",
"disabled": true,
"position": [
944,
-432
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1833398336,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Lz3yPqAfKfCvFjfkWKHj9d_3hyscgF6MdCSQMLAKE58/edit#gid=1833398336",
"cachedResultName": "Demo_Emails"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Lz3yPqAfKfCvFjfkWKHj9d_3hyscgF6MdCSQMLAKE58",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Lz3yPqAfKfCvFjfkWKHj9d_3hyscgF6MdCSQMLAKE58/edit?usp=drivesdk",
"cachedResultName": "FTAIM.com Outlook Inbox Demo"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "37963fb1-20e8-42f3-a044-e023cdd8d64c",
"name": "When clicking \u2018Execute workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"disabled": true,
"position": [
720,
-432
],
"parameters": {},
"typeVersion": 1
},
{
"id": "56075617-5897-4520-b91a-65bf954f6925",
"name": "Send Demo Emails",
"type": "n8n-nodes-base.gmail",
"disabled": true,
"position": [
1168,
-432
],
"parameters": {
"sendTo": "user@example.com",
"message": "={{ $json.Body }}",
"options": {},
"subject": "={{ $json.Subject }}",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "03343623-3a36-4e40-998b-203bc72e4e9f",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"disabled": true,
"position": [
640,
-560
],
"parameters": {
"color": 2,
"width": 800,
"height": 432,
"content": "## Demo Email Generator\nSends sample emails to test classification logic.\n"
},
"typeVersion": 1
},
{
"id": "b2b0d54e-7138-4bde-9422-2c1193976b5f",
"name": "Mark as Read",
"type": "n8n-nodes-base.gmail",
"disabled": true,
"position": [
2384,
-3072
],
"parameters": {
"messageId": "={{ $json.choices[0].message.content.id }}",
"operation": "markAsRead"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "8acf7218-c375-43dd-a83f-451f878a66a6",
"name": "Remove From Inbox",
"type": "n8n-nodes-base.gmail",
"position": [
2608,
-3072
],
"parameters": {
"labelIds": [
"INBOX"
],
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "cadf9fb5-4303-4698-bb3c-5470e580f179",
"name": "Mark as Read1",
"type": "n8n-nodes-base.gmail",
"disabled": true,
"position": [
2384,
-2672
],
"parameters": {
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "markAsRead"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "a4925b85-3ccb-414c-abca-74891a993337",
"name": "Remove From Inbox1",
"type": "n8n-nodes-base.gmail",
"position": [
2608,
-2672
],
"parameters": {
"labelIds": [
"INBOX"
],
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "4d45871c-e67b-4fd8-bd1a-38ed7b2f77e7",
"name": "Mark as Read2",
"type": "n8n-nodes-base.gmail",
"position": [
2176,
-2256
],
"parameters": {
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "markAsRead"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "d060edb0-2527-492c-9e9b-f1dd31c5c3d0",
"name": "Remove From Inbox2",
"type": "n8n-nodes-base.gmail",
"position": [
2400,
-2256
],
"parameters": {
"labelIds": [
"INBOX"
],
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "e18fa4fd-d770-4a67-90f4-4278189a931f",
"name": "Mark as Read3",
"type": "n8n-nodes-base.gmail",
"disabled": true,
"position": [
2400,
-1888
],
"parameters": {
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "markAsRead"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "1fcbb724-4fa6-4e99-ad5b-41d06d34127d",
"name": "Remove From Inbox3",
"type": "n8n-nodes-base.gmail",
"position": [
2624,
-1888
],
"parameters": {
"labelIds": [
"INBOX"
],
"messageId": "={{ $('Gmail Trigger1').item.json.id }}",
"operation": "removeLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "e7cfa408-c22c-4ba8-bd15-712fbda814b9",
"name": "Email Classifier Agent",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
896,
-2448
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=incoming email \nEmail_Subject: {{ $json.subject }}\nEmail_Body: {{ $json.text }}\n\nEntire email is \n{{ JSON.stringify($json) }}"
},
{
"role": "system",
"content": "=You are an intelligent Email Classifier Agent.\n\nClassify the provided email into one of these categories:\n\n- High_Priority: Emails requiring immediate attention or action from key stakeholders, clients, or decision-makers. Typically time-sensitive with requests, deadlines, or escalated issues. Keywords: urgent, ASAP, immediate, deadline, action required, high priority.\n\n- Customer_Support: Emails related to ongoing communication with current clients or New customers seeking information about our Services, including service requests, feedback, support tickets, and inquiries. Keywords: request for information, Inquiry, support, question, follow-up, feedback. You have access to Google Sheet tool \"FTAI_Info\". Use this tool to get information about our Courses and Company.\n\n- Promotions: Emails about marketing campaigns, promotional offers, newsletters, or business updates from partners. Keywords: newsletter, promotion, offer, sale, campaign, marketing, launch.\n\n- Finance/Billing: Emails dealing with financial matters such as invoices, billing statements, payment reminders, or expense reports. Keywords: invoice, payment, billing, receipt, financial, expense, account.\n\nDo not explain your reasoning. Only output a JSON object with the exact fields and classification.\n"
},
{
"role": "assistant",
"content": "=you need to clean up the html tags and any other data coming in the email\n\njust output clean data in JSON format as follows\n\n{\n \"id\": \"abc123\",\n \"createdDateTime\": \"2025-09-09T12:00:00Z\",\n \"lastModifiedDateTime\": \"2025-09-09T12:00:00Z\",\n \"receivedDateTime\": \"2025-09-09T11:59:00Z\",\n \"hasAttachments\": false,\n \"subject\": \"subject\",\n \"isRead\": false,\n \"body\": \"Entire body cleaned up\",\n \"sender\": \"billing@vendor.com\",\n \"from\": \"billing@vendor.com\",\n \"toRecipients\": \"me@company.com\",\n \"classification\": \"Finance/Billing\"\n}"
}
]
},
"simplify": false,
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "aebbf62b-2c4e-4426-9707-daed2e06f615",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
1248,
-2480
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "High_Priority",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "3b23febe-bfaa-4b9d-9838-fe641809e860",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.choices[0].message.content.classification }}",
"rightValue": "High_Priority"
}
]
},
"renameOutput": true
},
{
"outputKey": "Customer_Support",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "259f7d05-9afb-4ea7-9861-bf8d0f221de5",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.choices[0].message.content.classification }}",
"rightValue": "Customer_Support"
}
]
},
"renameOutput": true
},
{
"outputKey": "Promotions",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "f9628c15-50d6-41a0-8264-df4728d5a9c4",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.choices[0].message.content.classification }}",
"rightValue": "Promotions"
}
]
},
"renameOutput": true
},
{
"outputKey": "Finance/Billing",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "5f90675b-ac38-4a35-89ad-1c816352bff6",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.choices[0].message.content.classification }}",
"rightValue": "Finance/Billing"
}
]
},
"renameOutput": true
}
]
},
"options": {},
"looseTypeValidation": true
},
"typeVersion": 3.2
},
{
"id": "6bcf1e73-c19d-43dc-9db8-c60bdf8e6ba4",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"disabled": true,
"position": [
1776,
-576
],
"parameters": {
"color": 7,
"width": 800,
"height": 432,
"content": "## Demo Cleanup\nDeletes test emails to reset the inbox.\n"
},
"typeVersion": 1
},
{
"id": "4df01370-51e2-4967-ba70-acc7463c88e7",
"name": "Read_all_Emails",
"type": "n8n-nodes-base.gmail",
"disabled": true,
"position": [
1840,
-432
],
"parameters": {
"filters": {
"includeSpamTrash": true
},
"operation": "getAll",
"returnAll": true
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "7a3aa5fe-8848-420d-a314-d7603c7c3c90",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"disabled": true,
"position": [
2048,
-432
],
"parameters": {
"options": {},
"batchSize": 5
},
"typeVersion": 3
},
{
"id": "f3bc636a-b1f0-4919-9998-7c524e55ca25",
"name": "Delete a message",
"type": "n8n-nodes-base.gmail",
"disabled": true,
"position": [
2352,
-384
],
"parameters": {
"messageId": "={{ $json.id }}",
"operation": "delete"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "b1c36e59-4a3a-459a-aa7d-b15824fce210",
"name": "Clean Inbox",
"type": "n8n-nodes-base.telegram",
"disabled": true,
"position": [
2336,
-544
],
"parameters": {
"text": "=All Demo Emails Deleted",
"chatId": "123456789",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"executeOnce": true,
"typeVersion": 1.2
},
{
"id": "6e37cb34-6e8e-41a5-9885-7a09aa866522",
"name": "FTAI Info",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
1984,
-2432
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1081927447,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Lz3yPqAfKfCvFjfkWKHj9d_3hyscgF6MdCSQMLAKE58/edit#gid=1081927447",
"cachedResultName": "FTAI RAG"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Lz3yPqAfKfCvFjfkWKHj9d_3hyscgF6MdCSQMLAKE58",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Lz3yPqAfKfCvFjfkWKHj9d_3hyscgF6MdCSQMLAKE58/edit?usp=drivesdk",
"cachedResultName": "FTAIM.com Outlook Inbox Demo"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "1fdd5bcc-6660-42c5-9cd5-d7d38431e04b",
"name": "Promotions",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1824,
-2256
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are in charge of promotions. Please evaluate the incoming promotional email and give us a quick summary and a recommendation.\n\nHere is the incoming message: {{ $('Gmail Trigger1').item.json.text }}\n\nPlease output the following parameters separately:\nSummary\nRecommendation\nText_Message: This is to notify the respective team over slack / telegram"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.5
},
{
"id": "2b5e9edf-0a1e-49fd-8dec-9aa578804657",
"name": "Finance / Billing Dept",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1824,
-1888
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are a finance/billing assistant. Your job is to summarize incoming emails relating to finance and billing and summarize them in a short and concise way.\n\nHere is the incoming email: {{ $('Gmail Trigger1').item.json.text }}\n\nPlease output the following parameters:\nSubject\nMessage\nText_Message: This is to notify the respective team over slack / telegram"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.5
},
{
"id": "fa2d5f16-6b24-408b-96f4-79fbff8a9471",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-400,
-2784
],
"parameters": {
"width": 1008,
"height": 560,
"content": "# \ud83d\udce8 Gmail Classifier \u2014Classify emails using AI and automate responses\n\n## How it works\nThis workflow monitors incoming Gmail messages and uses an AI classifier to categorize each email into High Priority, Customer Support, Promotions, or Finance/Billing. \nA central switch routes emails to the correct handling logic, where AI responders generate drafts, summaries, or auto-replies. Optional Telegram alerts notify internal teams in real time. \nDemo utilities are included to simulate emails and reset the inbox during testing.\n\n## Setup steps\n1. Add credentials for Gmail and OpenAI (Telegram optional).\n2. (Optional) Enable **Send Demo Emails** to populate your inbox with test messages.\n3. (Optional) Run **Delete Demo Emails** to reset the inbox.\n4. Enable the Gmail Trigger (UNREAD filter recommended).\n5. Review and customize responder prompts for tone, escalation, and SOPs.\n6. Activate the workflow to start live classification.\n\n**Author:** Sandeep Patharkar \n**Community:** https://www.skool.com/aic-plus \n**Website:** https://www.fasttrackaimastery.com\n"
},
"typeVersion": 1
},
{
"id": "2e35c35e-a4f7-4052-8757-5a8458a763fa",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
736,
-928
],
"parameters": {
"color": 4,
"width": 464,
"height": 320,
"content": "## \ud83d\udce4 Send Demo Emails (Testing and Simulating bulk email)\n\n### \ud83d\udcdd What This Does \nQuickly sends a batch of demo emails to your Gmail inbox so you can test every category without manually sending anything.\n\n### \ud83c\udfaf Why Use It \nTesting email automation usually requires writing dozens of emails. \nThis tool generates realistic test messages instantly.\n\n"
},
"typeVersion": 1
},
{
"id": "68ec13fa-0dad-4c2e-964c-bc36d632166e",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1792,
-832
],
"parameters": {
"color": 3,
"width": 688,
"height": 192,
"content": "## \ud83d\uddd1\ufe0f Delete Demo Emails (\u26a0\ufe0f Wipes Inbox \u2014 Use Carefully)\n\n### \ud83d\udcdd What This Does \nDeletes all demo/test emails from your Gmail inbox so you can start fresh for the next testing cycle.\n\nBe VERY CAREFUL WITH THE REAL GMAIL ACCOUNT."
},
"typeVersion": 1
},
{
"id": "9437b754-0640-419b-94b5-cd378a354c5c",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1136,
-3056
],
"parameters": {
"color": 5,
"width": 336,
"height": 112,
"content": "## High Priority Emails\nA Draft will be created for Human in the Loop"
},
"typeVersion": 1
},
{
"id": "4510d3c3-2c8d-4df9-8f91-2930bd946483",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
2080,
-3232
],
"parameters": {
"width": 272,
"height": 128,
"content": "## Human in the Loop Review\n**Before sending out"
},
"typeVersion": 1
},
{
"id": "0977808f-5b1b-43fa-bf3e-b10372367f24",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
1760,
-2848
],
"parameters": {
"color": 4,
"width": 352,
"height": 144,
"content": "## Customer Support Auto-Responder\nAI generates replies using internal Q&A and SOP data.\n"
},
"typeVersion": 1
},
{
"id": "c821488f-a542-417b-af4a-2c3966ec1d52",
"name": "Sticky Note12",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
-1152
],
"parameters": {
"color": 7,
"width": 2496,
"height": 128,
"content": "## Demo Email setup and Cleanup ( Activate if Needed)\n"
},
"typeVersion": 1
}
],
"connections": {
"Draft1": {
"main": [
[
{
"node": "Mark as Read",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "High Priority1",
"type": "main",
"index": 0
}
],
[
{
"node": "Customer Support1",
"type": "main",
"index": 0
}
],
[
{
"node": "Promotion1",
"type": "main",
"index": 0
}
],
[
{
"node": "Finance/Billing1",
"type": "main",
"index": 0
}
]
]
},
"FTAI Info": {
"ai_tool": [
[
{
"node": "Creating Email1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Promotion1": {
"main": [
[
{
"node": "Promotions",
"type": "main",
"index": 0
}
]
]
},
"Promotions": {
"main": [
[
{
"node": "Mark as Read2",
"type": "main",
"index": 0
}
]
]
},
"Auto Reply1": {
"main": [
[
{
"node": "Mark as Read1",
"type": "main",
"index": 0
}
]
]
},
"Mark as Read": {
"main": [
[
{
"node": "Remove From Inbox",
"type": "main",
"index": 0
}
]
]
},
"Mark as Read1": {
"main": [
[
{
"node": "Remove From Inbox1",
"type": "main",
"index": 0
}
]
]
},
"Mark as Read2": {
"main": [
[
{
"node": "Remove From Inbox2",
"type": "main",
"index": 0
}
]
]
},
"Mark as Read3": {
"main": [
[
{
"node": "Remove From Inbox3",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger1": {
"main": [
[
{
"node": "Email Classifier Agent",
"type": "main",
"index": 0
}
]
]
},
"High Priority1": {
"main": [
[
{
"node": "Creating Draft1",
"type": "main",
"index": 0
}
]
]
},
"Creating Draft1": {
"main": [
[
{
"node": "Draft1",
"type": "main",
"index": 0
}
]
]
},
"Creating Email1": {
"main": [
[
{
"node": "Auto Reply1",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Clean Inbox",
"type": "main",
"index": 0
}
],
[
{
"node": "Delete a message",
"type": "main",
"index": 0
}
]
]
},
"Read_all_Emails": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Delete a message": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Finance/Billing1": {
"main": [
[
{
"node": "Finance / Billing Dept",
"type": "main",
"index": 0
}
]
]
},
"Customer Support1": {
"main": [
[
{
"node": "Creating Email1",
"type": "main",
"index": 0
}
]
]
},
"Remove From Inbox": {
"main": [
[
{
"node": "Notify (1)1",
"type": "main",
"index": 0
}
]
]
},
"Remove From Inbox1": {
"main": [
[
{
"node": "Notify (2)1",
"type": "main",
"index": 0
}
]
]
},
"Remove From Inbox2": {
"main": [
[
{
"node": "Notify (3)1",
"type": "main",
"index": 0
}
]
]
},
"Remove From Inbox3": {
"main": [
[
{
"node": "Notify (4)1",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet": {
"main": [
[
{
"node": "Send Demo Emails",
"type": "main",
"index": 0
}
]
]
},
"Send to Finance Dept1": {
"main": [
[
{
"node": "Mark as Read3",
"type": "main",
"index": 0
}
]
]
},
"Email Classifier Agent": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Finance / Billing Dept": {
"main": [
[
{
"node": "Send to Finance Dept1",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Get row(s) in sheet",
"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.
gmailOAuth2googleSheetsOAuth2ApiopenAiApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow delivers a complete, enterprise-grade Gmail automation system designed for high-volume teams. It classifies incoming emails, applies labels, generates AI-powered responses, and routes messages to the right department. It also includes optional demo email generation…
Source: https://n8n.io/workflows/11265/ — 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.
Your AI workforce is ready. Are you?
This n8n template automatically classifies incoming emails (Sales, Support, Internal, Finance, Promotions) and routes them to a dedicated OpenAI LLM Agent for processing. Depending on the category, th
Automate your personal productivity with this intelligent n8n workflow that integrates Telegram, Google Sheets, and OpenAI (GPT-4o). This system uses multiple AI agents to manage work hours, tasks, fi
Unleash the full potential of your HighLevel CRM by adding an intelligent GPT-5 Agent that does more than just follow commands — it understands context, retrieves the right data, and executes actions
Domain Outbound Machine is an n8n workflow designed to fully automate the domain sales process: lead generation, email extraction, personalized outreach, and automated email sending. It also stores ex