This workflow corresponds to n8n.io template #5446 — 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": "SjqkLDL6TjA4qhXe",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "InboxPilot",
"tags": [],
"nodes": [
{
"id": "66e1eca5-d977-4ead-8138-8eab926dfbfb",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
0,
0
],
"parameters": {
"filters": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "87e1fc81-4e18-4f7b-b3f3-d4cdc8f740a6",
"name": "Message a model",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
220,
0
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You're an email assistant for a busy startup founder. Classify the email content into the following fields and return **only raw JSON** (no markdown):\n\n{\n \"summary\": [Short summary of the email in 1 sentence],\n \"urgency\": [High, Medium, Low],\n \"category\": [Investor, Customer Lead, Support, Spam, Other],\n \"intent\": [Short phrase, like \"Request for call\", \"Feature request\", \"Follow-up\"]\n}\n\nAnalyze the following email:\n\nSubject: {{ $json.Subject }}\nBody: {{ $json.snippet }}\n\nReturn only valid JSON with no extra formatting.\n"
}
]
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.8
},
{
"id": "c457ff9f-2b06-4b15-91e8-41fb9dff5ffa",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
880,
0
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "1ec24de2-2e64-4386-aa00-62603a63aef5",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.urgency }}",
"rightValue": "High"
},
{
"id": "0ed8beae-9ef7-46b7-9aca-5cd83412bceb",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.urgency }}",
"rightValue": "Medium"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "ce7d28e9-9ace-4ec8-8408-0d7e6059675f",
"name": "Code",
"type": "n8n-nodes-base.code",
"position": [
580,
0
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "let raw = $json.message?.content || $json.message || \"\";\n\n// Remove triple backticks (```json ... ```)\nraw = raw.replace(/```json|```/g, '').trim();\n\n// Fix smart quotes and other formatting problems\nraw = raw.replace(/[\u201c\u201d]/g, '\"').replace(/[\u2018\u2019]/g, \"'\");\n\ntry {\n const parsed = JSON.parse(raw);\n\n return {\n summary: parsed.summary || \"No summary provided\",\n urgency: parsed.urgency || \"Unknown\",\n category: parsed.category || \"Unknown\",\n intent: parsed.intent || \"Unknown\"\n };\n} catch (err) {\n return {\n summary: \"\u26a0\ufe0f Failed to parse GPT output\",\n urgency: \"Unknown\",\n category: \"Unknown\",\n intent: \"Unknown\",\n error: err.message,\n original: raw\n };\n}\n"
},
"typeVersion": 2
},
{
"id": "353b70b5-eaad-4636-9bed-23aec2556d47",
"name": "Send a message",
"type": "n8n-nodes-base.slack",
"position": [
1080,
-100
],
"parameters": {
"text": "=\ud83d\udcec *Important Email Detected* *Summary:* {{ $('Code').item.json.summary }} *Urgency:* {{ $('Code').item.json.urgency }} \ud83d\udce5 From: {{ $('Gmail Trigger').item.json.From }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C093BMY0ESX",
"cachedResultName": "alerts"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 2.3
},
{
"id": "e9d6f184-b2ef-41aa-9df0-e58861a93a2e",
"name": "Add label to message",
"type": "n8n-nodes-base.gmail",
"position": [
1080,
40
],
"parameters": {
"labelIds": [
"Label_2"
],
"messageId": "={{ $node[\"Gmail Trigger\"].json[\"id\"] }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "f1109948-ab40-4f82-84f7-23fdbfc40d6b",
"name": "Add label to message1",
"type": "n8n-nodes-base.gmail",
"position": [
1300,
-100
],
"parameters": {
"labelIds": [
"Label_4585164412428469148"
],
"messageId": "={{ $node[\"Gmail Trigger\"].json[\"id\"] }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "73ea5151-4ef3-43b7-a73e-cd5d7f736363",
"name": "Append row in sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
1520,
-100
],
"parameters": {
"columns": {
"value": {
"From": "={{ $('Gmail Trigger').item.json.From }}",
"Summary": "={{ $('Code').item.json.summary }}",
"Urgency": "={{ $('Code').item.json.urgency }}",
"Category": "={{ $('Code').item.json.category }}",
"Timestamp": "={{ $now }}"
},
"schema": [
{
"id": "Timestamp",
"type": "string",
"display": true,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "From",
"type": "string",
"display": true,
"required": false,
"displayName": "From",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Summary",
"type": "string",
"display": true,
"required": false,
"displayName": "Summary",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Urgency",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Urgency",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Category",
"type": "string",
"display": true,
"required": false,
"displayName": "Category",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit?usp=drivesdk",
"cachedResultName": "Inbox Log"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "c588a35e-0230-4134-bf06-d6a0d3d5cda1",
"name": "Append row in sheet1",
"type": "n8n-nodes-base.googleSheets",
"position": [
1300,
60
],
"parameters": {
"columns": {
"value": {
"From": "={{ $('Gmail Trigger').item.json.From }}",
"Summary": "={{ $('Code').item.json.summary }}",
"Urgency": "={{ $('Code').item.json.urgency }}",
"Category": "={{ $('Code').item.json.category }}",
"Timestamp": "={{ $now }}"
},
"schema": [
{
"id": "Timestamp",
"type": "string",
"display": true,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "From",
"type": "string",
"display": true,
"required": false,
"displayName": "From",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Summary",
"type": "string",
"display": true,
"required": false,
"displayName": "Summary",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Urgency",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Urgency",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Category",
"type": "string",
"display": true,
"required": false,
"displayName": "Category",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit?usp=drivesdk",
"cachedResultName": "Inbox Log"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "8f2cd361-317c-4aab-8712-4ac47d337af3",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
0,
220
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 19
}
]
}
},
"typeVersion": 1.2
},
{
"id": "34161afd-e52b-4d6d-a973-9c4c63cd218c",
"name": "Get row(s) in sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
220,
220
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YQgWOSF-UA9gR1_pc6RzJ3UeANqnqi29ldoUd_2CPug/edit?usp=drivesdk",
"cachedResultName": "Inbox Log"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "d8eeb0ff-6d67-4586-8512-4d4da995de27",
"name": "Code1",
"type": "n8n-nodes-base.code",
"position": [
440,
220
],
"parameters": {
"jsCode": "const today = new Date().toISOString().split(\"T\")[0];\n\nreturn items.filter(item => {\n const timestamp = item.json.Timestamp || item.json.timestamp || \"\";\n const urgency = (item.json.Urgency || item.json.urgency || \"\").toLowerCase();\n\n const rowDate = new Date(timestamp).toISOString().split(\"T\")[0];\n\n return rowDate === today && (urgency === \"high\" || urgency === \"medium\");\n});\n"
},
"typeVersion": 2
},
{
"id": "fbe2ac0e-b671-4bff-9ef1-db9abb7fc23c",
"name": "Code2",
"type": "n8n-nodes-base.code",
"position": [
660,
220
],
"parameters": {
"jsCode": "let text = `\ud83d\uddd3\ufe0f *Daily Digest \u2013 ${new Date().toLocaleDateString()}*\\n\\n`;\n\nif (items.length === 0) {\n text += \"_No important messages today._\";\n} else {\n items.forEach((item, index) => {\n text += `*${index + 1}.* ${item.json.Summary || \"No summary\"}\\nUrgency: ${item.json.Urgency || \"Unknown\"}\\nCategory: ${item.json.Category || \"Unknown\"}\\nIntent: ${item.json.Intent || \"N/A\"}\\n\\n`;\n });\n}\n\nreturn [{ json: { text } }];\n"
},
"typeVersion": 2
},
{
"id": "1ec81105-9ac6-4167-8dc4-c5742d99764a",
"name": "Send a message1",
"type": "n8n-nodes-base.slack",
"position": [
900,
220
],
"parameters": {
"text": "=\ud83e\udde0 *Inbox Assistant \u2013 Daily Digest* \n\ud83d\udcc5 *{{ $now.format(\"DD MMM YYYY\") }}* \n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\n{{ $json.text }}\n",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C0934EF3CRM",
"cachedResultName": "daily-digest"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 2.3
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "e2ed6dc8-752e-48cd-8ba9-c02d87ebfd88",
"connections": {
"If": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
],
[
{
"node": "Add label to message",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Code2",
"type": "main",
"index": 0
}
]
]
},
"Code2": {
"main": [
[
{
"node": "Send a message1",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"Send a message": {
"main": [
[
{
"node": "Add label to message1",
"type": "main",
"index": 0
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Send a message1": {
"main": [
[]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get row(s) in sheet",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Add label to message": {
"main": [
[
{
"node": "Append row in sheet1",
"type": "main",
"index": 0
}
]
]
},
"Add label to message1": {
"main": [
[
{
"node": "Append row 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.
gmailOAuth2googleSheetsOAuth2ApiopenAiApislackOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This n8n workflow acts as an AI-powered Inbox Assistant that automatically summarizes and classifies Gmail emails, prioritizes important messages, and sends a daily digest to Slack. It’s ideal for startup founders and small teams juggling investor intros, customer leads, and…
Source: https://n8n.io/workflows/5446/ — 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 workflow acts as your personal inbox assistant. It automatically filters, classifies, and responds to incoming emails using AI, saving you from manually sorting through leads or inquiries 24/7.
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