This workflow follows the Agent → Gmail 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 →
{
"name": "Smart inbox Assistant",
"nodes": [
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"simple": false,
"filters": {},
"options": {}
},
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.4,
"position": [
-320,
-112
],
"id": "884be219-232e-4e43-b2e5-6ca2f12db4f8",
"name": "Gmail Trigger",
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "06cc22d1-5c1c-44b4-a9aa-f8ce1b78372e",
"name": "subject",
"value": "={{ $json.headers.subject }}",
"type": "string"
},
{
"id": "613733c2-6ff4-43eb-b6fa-7b99769a2172",
"name": "from",
"value": "={{ $json.headers.from }}",
"type": "string"
},
{
"id": "56aa7b12-a7d0-49a6-811c-f95f068fafea",
"name": "text",
"value": "={{ $json.text }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-96,
-112
],
"id": "73a4bd7d-ad29-45d8-8d14-9b9cf93be03b",
"name": "Edit Fields"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 3
},
"conditions": [
{
"id": "432aa521-2587-42d7-9c11-441ede1997de",
"leftValue": "={{ $json.priority }}",
"rightValue": "High",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.3,
"position": [
704,
-112
],
"id": "941d250e-6078-4fcc-91e3-cfb777bcc60d",
"name": "If"
},
{
"parameters": {
"resource": "draft",
"subject": "= {{$('Gmail Trigger').item.json.subject}}",
"message": "={{ $('Arange data').item.json.draftReply }}",
"options": {
"sendTo": "={{ $('Edit Fields').item.json.from }}"
}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.2,
"position": [
928,
-16
],
"id": "9dd0f2fb-d242-4195-91ab-1a6724043b8c",
"name": "Create a draft",
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1AYxYQAzK-h7tgOeqenvvMI7IxC-7YcpZTDRUhyj0uA4",
"mode": "list",
"cachedResultName": "gmail inbox sheet",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1AYxYQAzK-h7tgOeqenvvMI7IxC-7YcpZTDRUhyj0uA4/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1AYxYQAzK-h7tgOeqenvvMI7IxC-7YcpZTDRUhyj0uA4/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Date": "={{ $now.format('yyyy-MM-dd') }}",
"Sender": "={{ $('Edit Fields').item.json.from }}",
"Subject": "={{ $('Edit Fields').item.json.subject }}",
"Category": "={{ $('Arange data').item.json.category }}",
"Priority": "={{ $('Arange data').item.json.priority }}",
"Summary": "={{ $('Arange data').item.json.summary }}",
"Draft Created": "={{ $('Arange data').item.json.draftReply }}"
},
"matchingColumns": [],
"schema": [
{
"id": "Date",
"displayName": "Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Sender",
"displayName": "Sender",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Subject",
"displayName": "Subject",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Category",
"displayName": "Category",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Priority",
"displayName": "Priority",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Summary",
"displayName": "Summary",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Draft Created",
"displayName": "Draft Created",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
1152,
-16
],
"id": "f69aa51f-387d-47b7-b74f-bcf4e77ae8cd",
"name": "Append row in sheet",
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"sendTo": "areelarshad8080@gmail.com",
"subject": "={{ $('Edit Fields').item.json.subject }}",
"message": "={{ $json.draftReply }}",
"options": {}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.2,
"position": [
928,
-208
],
"id": "0411d1f3-8c3b-4996-8b74-5cd94ac8345d",
"name": "Send urgent mesg",
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "// Get AI output\nlet output = $json.output;\n\n// Remove markdown code fences\noutput = output.replace(/```json\\s*/i, \"\");\noutput = output.replace(/```\\s*$/i, \"\");\noutput = output.trim();\n\ntry {\n // Convert string to JSON\n const parsed = JSON.parse(output);\n\n return [\n {\n json: parsed\n }\n ];\n} catch (error) {\n throw new Error(\"Invalid JSON received from AI:\\n\\n\" + output);\n}"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
480,
-112
],
"id": "2dfb9ac0-8018-43d3-801b-fcb9a8d040c8",
"name": "Arange data"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1.1,
"position": [
208,
112
],
"id": "92d1d370-a0a5-4800-87ff-e3957de80c84",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"promptType": "define",
"text": "=Subject:\n{{ $json.subject }}\n\nFrom:\n{{ $json.from }}\n\nBody:\n{{ $json.text }}",
"options": {
"systemMessage": "You are an AI Email Assistant.\n\nAnalyze the email.\n\nReturn ONLY valid JSON.\n\n{\n \"category\":\"\",\n \"priority\":\"\",\n \"summary\":\"\",\n \"draftReply\":\"\"\n}\n\nCategories:\n- Sales\n- Support\n- Meeting\n- Billing\n- Personal\n- Spam\n- Other\n\nPriority:\nHigh\nMedium\nLow\n \nPriority Rules:\n- High = Urgent, deadlines today, payment overdue, customer complaint, legal issue, production outage.\n- Medium = Meeting requests, project discussions, quotations, business inquiries.\n- Low = Newsletters, promotional emails, general information, greetings.\n\n\nSummary:\nMaximum 2 sentences.\n\nDraft Reply:\nProfessional, polite, ready to send.\nDo not include subject."
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
128,
-112
],
"id": "1cdbecab-41da-4589-8ec8-0ddd994d9913",
"name": "smart email response generator",
"retryOnFail": true
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1AYxYQAzK-h7tgOeqenvvMI7IxC-7YcpZTDRUhyj0uA4",
"mode": "list",
"cachedResultName": "gmail inbox sheet",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1AYxYQAzK-h7tgOeqenvvMI7IxC-7YcpZTDRUhyj0uA4/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1AYxYQAzK-h7tgOeqenvvMI7IxC-7YcpZTDRUhyj0uA4/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Date": "={{ $now.format('yyyy-MM-dd') }}",
"Sender": "={{ $('Edit Fields').item.json.from }}",
"Subject": "={{ $('Edit Fields').item.json.subject }}",
"Category": "={{ $('Arange data').item.json.category }}",
"Priority": "={{ $('Arange data').item.json.priority }}",
"Summary": "={{ $('Arange data').item.json.summary }}",
"Draft Created": "={{ $('Arange data').item.json.draftReply }}"
},
"matchingColumns": [],
"schema": [
{
"id": "Date",
"displayName": "Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Sender",
"displayName": "Sender",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Subject",
"displayName": "Subject",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Category",
"displayName": "Category",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Priority",
"displayName": "Priority",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Summary",
"displayName": "Summary",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Draft Created",
"displayName": "Draft Created",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
1152,
-208
],
"id": "3a7f1322-4c11-4687-a5f1-927242c891c2",
"name": "Append row in sheet1",
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Gmail Trigger": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "smart email response generator",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Send urgent mesg",
"type": "main",
"index": 0
}
],
[
{
"node": "Create a draft",
"type": "main",
"index": 0
}
]
]
},
"Create a draft": {
"main": [
[
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
]
]
},
"Arange data": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "smart email response generator",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"smart email response generator": {
"main": [
[
{
"node": "Arange data",
"type": "main",
"index": 0
}
]
]
},
"Send urgent mesg": {
"main": [
[
{
"node": "Append row in sheet1",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"binaryMode": "separate",
"availableInMCP": false
},
"versionId": "cc67f178-43c7-434e-8213-62c33b7dae45",
"meta": {
"templateCredsSetupCompleted": true
},
"nodeGroups": [],
"id": "QLLXHKUwpZvVhbfT",
"tags": []
}
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.
gmailOAuth2googlePalmApigoogleSheetsOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Smart inbox Assistant. Uses gmailTrigger, gmail, googleSheets, lmChatGoogleGemini. Event-driven trigger; 10 nodes.
Source: https://github.com/buildwithareel/Smart-Inbox-Assistant-n8n/blob/main/workflow-file/workflow.json — 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.
Turn a simple email workflow into a LinkedIn content machine. Generate post ideas, draft full posts, and auto-publish to LinkedIn all controlled by replying to emails.
This workflow is for hotel managers, travel agencies, and hospitality teams who receive booking requests via email. It eliminates the need for manual data entry by automatically parsing emails and att
This workflow captures LinkedIn post topics from incoming Gmail messages into Google Sheets, then runs daily cleanup and AI generation with Google Gemini to publish a post to a LinkedIn organization p
Manual financial reconciliation is tedious and prone to error. This workflow functions as an AI Financial Controller, automatically monitoring your inbox for invoices, receipts, and bills, extracting
This template is designed for healthcare providers, sales reps, and medical tourism companies who need to process diagnosis emails efficiently. It automates the full flow from email to report delivery