This workflow corresponds to n8n.io template #7011 — 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": "TbwP9QUjXidVVh4Z",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "AI-Powered Email Inbox Manager with GPT-4, Gmail, and Slack Integration",
"tags": [],
"nodes": [
{
"id": "bbe4335e-71cd-480d-b021-b9e650fe8378",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-704,
128
],
"parameters": {
"simple": false,
"filters": {
"labelIds": [
"UNREAD"
]
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "4a50fc40-2859-42d4-87d3-6513e193fe17",
"name": "Text Classifier",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
-480,
128
],
"parameters": {
"options": {},
"inputText": "={{ $json.text }}",
"categories": {
"categories": [
{
"category": "Internal",
"description": "=Emails from the parent domain (prvndigital.com) from employees. Keywords: request, inquiry,\nsupport, question, follow-up, feedback"
},
{
"category": "Customer Support",
"description": "=Emails related to ongoing communication with current clients or customers, including service\nrequests, feedback, support tickets, and inquiries. Keywords: request, inquiry, support, question,\nfollow-up, feedback"
},
{
"category": "Promotions",
"description": "=Emails related to marketing campaigns, promotional offers, newsletters, or business updates\nfrom partners. Typically these emails contain content aimed at engaging an audience or\nupdating them on promotions. Keywords: newsletter, promotion, offer, sale, campaign,\nmarketing, launch"
},
{
"category": "Admin/Finance",
"description": "=Emails related to admin or financial matters, such as invoices, billing statements, payment\nreminders, or expense reports. Anything involving transactions or accounting should fall under\nthis label. Keywords: invoice, payment, billing, receipt, financial, expense, account"
},
{
"category": "Sales Opportunities",
"description": "=Emails related to sales. These could include service inquiries, pricing requests, referrals etc."
}
]
}
},
"typeVersion": 1.1
},
{
"id": "ed818fb1-8087-4c2e-b175-c9bc8ea36f82",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-408,
448
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "b10b46ad-13df-4c1d-8608-21d3f8ba34f9",
"name": "Promotion",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
128
],
"parameters": {
"labelIds": [
"Label_1545496588916418018"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "50754308-afe4-4299-acc0-02aebf248af3",
"name": "Internal",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
-256
],
"parameters": {
"labelIds": [
"Label_1524539159551949340"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "06cf291a-6f8d-4743-b8a1-1a17164508f0",
"name": "Customer Support",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
-64
],
"parameters": {
"labelIds": [
"Label_4804911835581558556"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "f333483a-4d84-4d8b-846d-13b408d264a8",
"name": "Admin/Finance",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
320
],
"parameters": {
"labelIds": [
"Label_1226745938983889262"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "f7883340-b00d-4c77-b1a6-f2a2512190bc",
"name": "Sales Opportunity",
"type": "n8n-nodes-base.gmail",
"position": [
-128,
512
],
"parameters": {
"labelIds": [
"Label_7406356819911928694"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "0c1e22e5-492d-48f9-bb9c-3387a85b16ee",
"name": "Mark a message as read1",
"type": "n8n-nodes-base.gmail",
"position": [
656,
160
],
"parameters": {
"messageId": "={{$ ('Text Classifier').item.json.id}}",
"operation": "markAsRead"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "bc5bb950-c03a-4b3c-a70d-6a75f1c5f953",
"name": "Message a model",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
128
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are the Promotions Analyst in an AI email management system.\nYour role is to review incoming promotional emails, summarize the offer, and decide whether it\u2019s\nworth pursuing further.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n\u2022 Summary \u2013 What is being offered?\n\u2022 Recommendation \u2013 Is this worth exploring further? (Yes/No + brief reason)"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "dcfd27a4-6345-40e5-8edd-125f3b5438dc",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
448,
128
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ba4b6577-5d8e-495c-8ab5-a591f22af93e",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.message.content.Recommendation }}",
"rightValue": "yes"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "9fcf2dac-7101-42d8-9264-f84f0bd9bb47",
"name": "Message a model1",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
-256
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are an executive assistant handling internal emails from my team.\nRespond to high-priority emails with clarity and accuracy.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n\u2022 Subject\n\u2022 Message"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "3f937b75-9107-4ea6-b2ab-3008eed89964",
"name": "Message a model2",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
-64
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are a customer service representative.\nRespond to customer inquiries clearly and accurately.\nIf the request is outside your scope, direct the user to: support@prvndigital.com\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n\u2022 Subject\n\u2022 Message"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "f5496329-133e-438b-a946-e064deb03874",
"name": "Message a model3",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
320
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are a Finance & Billing Assistant.\nReview incoming emails related to payments, invoices, or account charges. Summarize the key\ndetails clearly and concisely.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n\u2022 Subject\n\u2022 Summary"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "e0523a68-8870-43fd-a879-c6f57e825e8f",
"name": "Message a model4",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
96,
512
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=Your job is to read incoming emails related to the sale of our products or services and draft a\nconcise, professional response. Include relevant details such as the contact\u2019s name, email,\nphone number, and any specific questions or requests they mentioned.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n\u2022 Subject \u2013 Appropriate subject line for your reply\n\u2022 Message \u2013 Drafted email response including relevant details\n- Notification - create a concise notification to be sent to a slack channel with the first line as\n\"New Sales Opportunity\" along with any relevant details"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "5211bfae-d7f2-4002-bb91-9268fbbbc0ba",
"name": "Create a draft",
"type": "n8n-nodes-base.gmail",
"position": [
448,
-256
],
"parameters": {
"message": "={{ $json,message.context.Message }}",
"options": {},
"subject": "={{ $json,message.context.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "7311a8ce-e2e4-41e5-9eb1-5a66115d6d68",
"name": "Slack",
"type": "n8n-nodes-base.slack",
"position": [
656,
-256
],
"parameters": {
"text": "Internal: New Draft Created ",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C08KU6HK28H",
"cachedResultName": "playground"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 2.3
},
{
"id": "204628dd-5ba3-40ca-91e7-7a91ef742a8b",
"name": "Create a draft2",
"type": "n8n-nodes-base.gmail",
"position": [
432,
-80
],
"parameters": {
"message": "={{ $json.message.content.Message }}",
"options": {},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "bf4ed803-6429-4de1-9b73-5bc3186e6cc2",
"name": "Create a draft1",
"type": "n8n-nodes-base.gmail",
"position": [
448,
320
],
"parameters": {
"message": "={{ $json.message.content.Message }}",
"options": {},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "76540b20-6619-4aec-9312-89e27940420c",
"name": "Slack1",
"type": "n8n-nodes-base.slack",
"position": [
656,
496
],
"parameters": {
"text": "={{ $('OpenAI4').item.json.message.content.Notification }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C08KU6HK28H",
"cachedResultName": "playground"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 2.3
},
{
"id": "23bafb22-a05a-4635-a698-c1bfd4b0d9e2",
"name": "Create a draft3",
"type": "n8n-nodes-base.gmail",
"position": [
432,
496
],
"parameters": {
"message": "={{ $json.message.content.Message }}",
"options": {},
"subject": "={{ $json.message.content.Subject }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "f9c7bbdf-e802-4f68-968a-ebf68ca521b6",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1376,
-352
],
"parameters": {
"width": 1088,
"height": 1680,
"content": "## AI-Powered Email Inbox Manager \n\nThis automation system intelligently handles your Gmail inbox using OpenAI and Slack to classify, label, respond to, and manage emails all without human input.\n\n**Gmail Trigger**\n\n-Checks Gmail every 1 minute\n\n-Filters for only UNREAD emails\n\n-Triggers the entire workflow pipeline\n\n-Ensures you're always processing fresh, unseen messages\n\n**Text Classifier**\n\nPowered by GPT-4 to analyzes email text and assigns one of 5 categories:\n\nInternal \u2013 Team messages from company domain\n\nCustomer Support \u2013 Inquiries, issues, or feedback\n\nPromotions \u2013 Campaigns, newsletters, sales\n\nAdmin/Finance - Invoices, payments, financial info\n\nSales Opportunity - Potential clients, pricing requests, referrals\n\n---Provides context aware categorization not just keyword-based\n\n**GPT-4 Support Node**\n\n-Enhances classifier accuracy\n\n-Handles classification logic and reasoning\n\n-Ensures consistent results over time\n\n**Gmail Labeling Nodes (x5)**\n\n-Applies the correct Gmail label depending on the classification\n\n-Keeps your inbox clean, organized, and filterable\n\n-Example: A customer complaint is instantly tagged under \"Customer Support\"\n\n**OpenAI Reply Generation (x5)**\n\nEach category has its own custom GPT-4 prompt:\n\nInternal: Replies on behalf of exec assistant\n\nCustomer Support: Friendly and clear client service\n\nPromotions: Summarizes the offer, evaluates usefulness\n\nFinance: Extracts payment/invoice summaries\n\nSales: Drafts responses, includes lead details + Slack alert\n\n**Draft Responses in Gmail**\n\n-GPT-4 outputs are saved as draft emails\n\n-Ready for your review or auto-send\n\n-Replies are well-formatted, concise, and personalized\n\n**Slack Notifications**\n\nNotifies your team on Slack when:\n\n-A new sales opportunity arrives\n\n-A high-priority internal message comes in\n\n-Boosts real-time awareness without inbox monitoring\n\n**Promotion Filter Logic**\n\n-GPT analyzes if a promo email is worth acting on\n\n-If not valuable, it\u2019s marked as read and ignored\n\n-Reduces inbox noise without missing opportunities"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "696854cc-592d-419d-9daf-8de6bb90b7af",
"connections": {
"If": {
"main": [
[],
[
{
"node": "Mark a message as read1",
"type": "main",
"index": 0
}
]
]
},
"Internal": {
"main": [
[
{
"node": "Message a model1",
"type": "main",
"index": 0
}
]
]
},
"Promotion": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"Admin/Finance": {
"main": [
[
{
"node": "Message a model3",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Text Classifier",
"type": "main",
"index": 0
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Text Classifier": {
"main": [
[
{
"node": "Internal",
"type": "main",
"index": 0
}
],
[
{
"node": "Customer Support",
"type": "main",
"index": 0
}
],
[
{
"node": "Promotion",
"type": "main",
"index": 0
}
],
[
{
"node": "Admin/Finance",
"type": "main",
"index": 0
}
],
[
{
"node": "Sales Opportunity",
"type": "main",
"index": 0
}
]
]
},
"Customer Support": {
"main": [
[
{
"node": "Message a model2",
"type": "main",
"index": 0
}
]
]
},
"Message a model1": {
"main": [
[
{
"node": "Create a draft",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Text Classifier",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Sales Opportunity": {
"main": [
[
{
"node": "Message a model4",
"type": "main",
"index": 0
}
]
]
},
"Mark a message as read1": {
"main": [
[]
]
}
}
}
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.
gmailOAuth2openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Email Automation AI-Powered Operations Internal Productivity Tools
Source: https://n8n.io/workflows/7011/ — 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
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
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