This workflow corresponds to n8n.io template #17554 — we link there as the canonical source.
This workflow follows the Agent → Datatable 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": "pUx3hX6xfnOWTEEj",
"meta": {
"builderVariant": "mcp",
"aiBuilderAssisted": true
},
"name": "AI Inbox Concierge \u2014 Smart Email Triage & Auto-Draft OS",
"tags": [],
"nodes": [
{
"id": "6fbe3041-b1d2-472d-b879-484dc23a6d6e",
"name": "New Email Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
0,
304
],
"parameters": {
"simple": false,
"filters": {
"readStatus": "unread"
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1.4
},
{
"id": "607657f4-7695-49bb-869c-e1f1c68ec971",
"name": "Extract Email",
"type": "n8n-nodes-base.set",
"position": [
224,
304
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e_from",
"name": "from",
"type": "string",
"value": "={{ $json.from ?? \"\" }}"
},
{
"id": "e_email",
"name": "sender_email",
"type": "string",
"value": "={{ ($json.from ?? \"\").match(/[^<\\s]+@[^>\\s]+/)?.[0] ?? $json.from ?? \"\" }}"
},
{
"id": "e_subj",
"name": "subject",
"type": "string",
"value": "={{ $json.subject ?? \"(no subject)\" }}"
},
{
"id": "e_body",
"name": "body",
"type": "string",
"value": "={{ $json.text ?? $json.textAsHtml ?? $json.snippet ?? \"\" }}"
},
{
"id": "e_thread",
"name": "threadId",
"type": "string",
"value": "={{ $json.threadId ?? \"\" }}"
},
{
"id": "e_msg",
"name": "messageId",
"type": "string",
"value": "={{ $json.messageId ?? $json.id ?? \"\" }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "cd580f8c-fc7c-41cd-b314-6486db5a6242",
"name": "AI Triage",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
464,
304
],
"parameters": {
"text": "=Triage this inbound email and draft a reply.\n\nFrom: {{ $json.from }}\nSubject: {{ $json.subject }}\n\nBody:\n{{ $json.body }}",
"options": {
"systemMessage": "You are an executive assistant triaging a business inbox. Classify each email. category is one of: Sales, Support, Billing, Partnership, Other. urgency is one of: High, Medium, Low (High = angry customer, hot lead, outage, payment failure, or a hard deadline; Low = FYI, newsletters, no action needed). sentiment is one of: positive, neutral, negative. summary is one plain sentence. needs_human is true when the reply requires a human decision, a quote, sensitive judgement, or legal/financial commitment. Then write a professional draft_reply as clean HTML (<p> paragraphs, warm and concise, addressed to the sender by first name, moving the conversation forward) and a matching draft_subject that keeps the thread (prefix with Re: when appropriate). Never invent prices, dates, or commitments; if unknown, ask a clarifying question or offer to follow up. Return ONLY the JSON object."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 3.1
},
{
"id": "bf942d6d-0a76-4ec9-80d1-ba0a5ebf4ae5",
"name": "Claude Sonnet 4.6",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"position": [
464,
528
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-sonnet-4-6",
"cachedResultName": "Claude Sonnet 4.6"
},
"options": {
"temperature": 0.1,
"maxTokensToSample": 1024
}
},
"typeVersion": 1.5
},
{
"id": "9d55ea7f-77f6-4205-82aa-52983cb1ae26",
"name": "Triage Schema",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
608,
544
],
"parameters": {
"jsonSchemaExample": "{ \"category\": \"Sales\", \"urgency\": \"High\", \"sentiment\": \"neutral\", \"summary\": \"Prospect asking for annual pricing for 40 seats.\", \"needs_human\": true, \"draft_subject\": \"Re: Question about your pricing\", \"draft_reply\": \"<p>Hi Ravi,</p><p>Thanks for reaching out.</p>\" }"
},
"typeVersion": 1.3
},
{
"id": "313674b2-40ae-48c0-af97-649e6b027d2b",
"name": "Shape Triage Record",
"type": "n8n-nodes-base.set",
"position": [
720,
304
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "t_from",
"name": "from",
"type": "string",
"value": "={{ $(\"Extract Email\").item.json.from }}"
},
{
"id": "t_email",
"name": "sender_email",
"type": "string",
"value": "={{ $(\"Extract Email\").item.json.sender_email }}"
},
{
"id": "t_subj",
"name": "subject",
"type": "string",
"value": "={{ $(\"Extract Email\").item.json.subject }}"
},
{
"id": "t_thread",
"name": "threadId",
"type": "string",
"value": "={{ $(\"Extract Email\").item.json.threadId }}"
},
{
"id": "t_cat",
"name": "category",
"type": "string",
"value": "={{ $json.category }}"
},
{
"id": "t_urg",
"name": "urgency",
"type": "string",
"value": "={{ $json.urgency }}"
},
{
"id": "t_sent",
"name": "sentiment",
"type": "string",
"value": "={{ $json.sentiment }}"
},
{
"id": "t_sum",
"name": "summary",
"type": "string",
"value": "={{ $json.summary }}"
},
{
"id": "t_nh",
"name": "needs_human",
"type": "boolean",
"value": "={{ $json.needs_human }}"
},
{
"id": "t_dsubj",
"name": "draft_subject",
"type": "string",
"value": "={{ $json.draft_subject }}"
},
{
"id": "t_dreply",
"name": "draft_reply",
"type": "string",
"value": "={{ $json.draft_reply }}"
},
{
"id": "t_action",
"name": "action_taken",
"type": "string",
"value": "={{ $json.urgency === \"High\" ? \"Draft created + urgent alert sent\" : \"Draft created + logged\" }}"
},
{
"id": "t_ts",
"name": "logged_at",
"type": "string",
"value": "={{ $now.toISO() }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "9ae84339-fe7a-4390-9e3a-76593579e831",
"name": "Log to Triage Table",
"type": "n8n-nodes-base.dataTable",
"position": [
992,
160
],
"parameters": {
"columns": {
"value": {
"subject": "={{ $(\"Shape Triage Record\").item.json.subject }}",
"summary": "={{ $(\"Shape Triage Record\").item.json.summary }}",
"urgency": "={{ $(\"Shape Triage Record\").item.json.urgency }}",
"category": "={{ $(\"Shape Triage Record\").item.json.category }}",
"logged_at": "={{ $(\"Shape Triage Record\").item.json.logged_at }}",
"sentiment": "={{ $(\"Shape Triage Record\").item.json.sentiment }}",
"needs_human": "={{ $(\"Shape Triage Record\").item.json.needs_human }}",
"action_taken": "={{ $(\"Shape Triage Record\").item.json.action_taken }}",
"received_from": "={{ $(\"Shape Triage Record\").item.json.from }}"
},
"schema": [
{
"id": "received_from",
"type": "string",
"display": true,
"required": false,
"displayName": "received_from",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "subject",
"type": "string",
"display": true,
"required": false,
"displayName": "subject",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "category",
"type": "string",
"display": true,
"required": false,
"displayName": "category",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "urgency",
"type": "string",
"display": true,
"required": false,
"displayName": "urgency",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "sentiment",
"type": "string",
"display": true,
"required": false,
"displayName": "sentiment",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "summary",
"type": "string",
"display": true,
"required": false,
"displayName": "summary",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "needs_human",
"type": "boolean",
"display": true,
"required": false,
"displayName": "needs_human",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "action_taken",
"type": "string",
"display": true,
"required": false,
"displayName": "action_taken",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "logged_at",
"type": "string",
"display": true,
"required": false,
"displayName": "logged_at",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow"
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "name",
"value": "email_triage_log"
}
},
"typeVersion": 1.1
},
{
"id": "0f657ef2-aecb-47b8-bb55-b9c560a8794f",
"name": "Create Draft Reply",
"type": "n8n-nodes-base.gmail",
"onError": "continueRegularOutput",
"maxTries": 3,
"position": [
992,
320
],
"parameters": {
"message": "={{ $(\"Shape Triage Record\").item.json.draft_reply }}",
"options": {
"sendTo": "={{ $(\"Shape Triage Record\").item.json.sender_email }}",
"threadId": "={{ $(\"Shape Triage Record\").item.json.threadId }}"
},
"subject": "={{ $(\"Shape Triage Record\").item.json.draft_subject }}",
"resource": "draft",
"emailType": "html"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 2.2,
"waitBetweenTries": 2000
},
{
"id": "d0b1d5c3-27c3-4d94-934c-2e5f9e680f46",
"name": "Route by Urgency",
"type": "n8n-nodes-base.switch",
"position": [
992,
480
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "High",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": false,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.urgency }}",
"rightValue": "High"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra",
"renameFallbackOutput": "Medium / Low"
}
},
"typeVersion": 3.4
},
{
"id": "4e8bec3d-c5be-4567-b472-046d344cb5c6",
"name": "Send Urgent Alert",
"type": "n8n-nodes-base.gmail",
"onError": "continueRegularOutput",
"maxTries": 3,
"position": [
1232,
464
],
"parameters": {
"sendTo": "<__PLACEHOLDER_VALUE__Your alert inbox, e.g. you@company.com__>",
"message": "=<p><strong>Urgent email needs attention.</strong></p><p><b>From:</b> {{ $(\"Shape Triage Record\").item.json.from }}<br><b>Subject:</b> {{ $(\"Shape Triage Record\").item.json.subject }}<br><b>Category:</b> {{ $(\"Shape Triage Record\").item.json.category }} | <b>Sentiment:</b> {{ $(\"Shape Triage Record\").item.json.sentiment }}</p><p><b>Summary:</b> {{ $(\"Shape Triage Record\").item.json.summary }}</p><p>A draft reply is already waiting in your Gmail drafts.</p>",
"options": {
"appendAttribution": false
},
"subject": "=\ud83d\udea8 Urgent {{ $(\"Shape Triage Record\").item.json.category }} email from {{ $(\"Shape Triage Record\").item.json.from }}"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 2.2,
"waitBetweenTries": 2000
},
{
"id": "f92becc5-b873-4ee7-a737-fd3baa90664d",
"name": "Draft Only \u2014 No Alert",
"type": "n8n-nodes-base.noOp",
"position": [
1232,
672
],
"parameters": {},
"typeVersion": 1
},
{
"id": "32308550-05b4-4e62-9d15-9e8eac1e7f35",
"name": "Sticky Note 13d02629",
"type": "n8n-nodes-base.stickyNote",
"position": [
-640,
-64
],
"parameters": {
"color": 4,
"width": 584,
"height": 504,
"content": "## \ud83d\udcec AI Inbox Concierge \u2014 Smart Email Triage & Auto-Draft OS\n\nEvery new email is classified by AI, a reply draft is written into the thread, everything is logged, and urgent items ping you instantly. Works for any business with an inbox.\n\n**Flow:** New email \u2192 Extract \u2192 AI Triage \u2192 Shape \u2192 log + draft reply + urgency routing.\n\n### Setup\n1. Connect **Gmail** (trigger, draft, alert) + **Anthropic** credentials.\n2. Set your alert inbox on the \"Send Urgent Alert\" node.\n3. Activate \u2014 the data table `email_triage_log` is already created."
},
"typeVersion": 1
},
{
"id": "8ab41ddd-3006-43e4-823e-56064d659879",
"name": "Sticky Note f1648cad",
"type": "n8n-nodes-base.stickyNote",
"position": [
336,
48
],
"parameters": {
"color": 6,
"width": 548,
"height": 216,
"content": "### \ud83e\udde0 AI Triage\nClaude assigns category (Sales / Support / Billing / Partnership / Other), urgency, sentiment, a one-line summary, and writes a ready-to-review HTML draft reply. It never invents prices or commitments. Swap for OpenAI if preferred."
},
"typeVersion": 1
},
{
"id": "0202bbee-0d40-472b-be10-8c32238e22fa",
"name": "Sticky Note 7f5d102a",
"type": "n8n-nodes-base.stickyNote",
"position": [
960,
-112
],
"parameters": {
"color": 3,
"width": 540,
"height": 232,
"content": "### \u26a1 Actions\nDraft reply lands in the correct Gmail thread (human reviews before sending \u2014 safe by design). High-urgency emails also send you an instant alert. All Gmail nodes retry 3\u00d7/2s and reference the **Shape** node explicitly, so fields never arrive null."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"availableInMCP": true,
"executionOrder": "v1"
},
"versionId": "844b90e9-d950-4935-ad76-e7060226f39f",
"nodeGroups": [],
"connections": {
"AI Triage": {
"main": [
[
{
"node": "Shape Triage Record",
"type": "main",
"index": 0
}
]
]
},
"Extract Email": {
"main": [
[
{
"node": "AI Triage",
"type": "main",
"index": 0
}
]
]
},
"Triage Schema": {
"ai_outputParser": [
[
{
"node": "AI Triage",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Route by Urgency": {
"main": [
[
{
"node": "Send Urgent Alert",
"type": "main",
"index": 0
}
],
[
{
"node": "Draft Only \u2014 No Alert",
"type": "main",
"index": 0
}
]
]
},
"Claude Sonnet 4.6": {
"ai_languageModel": [
[
{
"node": "AI Triage",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"New Email Trigger": {
"main": [
[
{
"node": "Extract Email",
"type": "main",
"index": 0
}
]
]
},
"Shape Triage Record": {
"main": [
[
{
"node": "Log to Triage Table",
"type": "main",
"index": 0
},
{
"node": "Create Draft Reply",
"type": "main",
"index": 0
},
{
"node": "Route by Urgency",
"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
This workflow monitors a Gmail inbox for unread messages, uses Anthropic Claude to classify and summarize each email, auto-drafts an HTML reply in the same thread, logs the triage result to an n8n Data Table, and sends an urgent alert email for high-priority items. Triggers…
Source: https://n8n.io/workflows/17554/ — 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.
An AI-powered Gmail assistant built with n8n that automatically labels emails, learns from your decisions, and safely improves over time using human-in-the-loop training.
Email Triage — Parse / Classify / Route / Auto-respond. Uses gmailTrigger, dataTable, lmChatOpenAi, outputParserStructured. Event-driven trigger; 19 nodes.
This workflow triggers on new Shopify orders, uses Anthropic Claude to generate a personalized HTML order confirmation with one relevant upsell suggestion, then emails the customer via Gmail and logs
This workflow triggers on successful Stripe charges, normalizes payment details, uses Anthropic Claude to generate a personalized thank-you and receipt message, logs the payment to an n8n Data Table,
Want to check out all my flows, follow me on: