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 →
{
"name": "AI Smart Reply Generator",
"nodes": [
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"filters": {
"readStatus": "unread"
},
"options": {}
},
"id": "b1b2c3d4-2002-4000-8000-000000000001",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.1,
"position": [
250,
300
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.labelIds }}",
"operation": "notContains",
"value2": "SENT"
}
]
}
},
"id": "b1b2c3d4-2002-4000-8000-000000000002",
"name": "Filter Sent Emails",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
500,
300
]
},
{
"parameters": {
"resource": "chat",
"model": "gpt-4",
"messages": {
"values": [
{
"content": "You are a professional email assistant. Draft a reply to the following email. Be polite, concise, and professional. Match the tone of the original email.\n\nFrom: {{ $json.from }}\nSubject: {{ $json.subject }}\nBody: {{ $json.text || $json.snippet }}\n\nReturn JSON with keys:\n- replySubject (include Re: prefix)\n- replyBody (the drafted reply text)\n- tone (detected tone: formal, casual, urgent)\n- confidence (0-1 score of how confident the reply is appropriate)"
}
]
},
"options": {
"temperature": 0.6,
"maxTokens": 1000
}
},
"id": "b1b2c3d4-2002-4000-8000-000000000003",
"name": "OpenAI Draft Reply",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.3,
"position": [
750,
300
]
},
{
"parameters": {
"jsCode": "const response = JSON.parse($input.first().json.message.content);\nconst emailData = $('Gmail Trigger').first().json;\nreturn [{\n json: {\n originalMessageId: emailData.id,\n threadId: emailData.threadId,\n to: emailData.from,\n subject: response.replySubject,\n body: response.replyBody,\n tone: response.tone,\n confidence: response.confidence\n }\n}];"
},
"id": "b1b2c3d4-2002-4000-8000-000000000004",
"name": "Parse Reply",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1000,
300
]
},
{
"parameters": {
"resource": "draft",
"operation": "create",
"subject": "={{ $json.subject }}",
"toList": "={{ $json.to }}",
"message": "={{ $json.body }}",
"options": {
"threadId": "={{ $json.threadId }}"
}
},
"id": "b1b2c3d4-2002-4000-8000-000000000005",
"name": "Create Gmail Draft",
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [
1250,
300
]
},
{
"parameters": {
"channel": "#email-drafts",
"text": ":email: Draft reply created\n*To:* {{ $json.to }}\n*Subject:* {{ $json.subject }}\n*Tone:* {{ $('Parse Reply').first().json.tone }}\n*Confidence:* {{ $('Parse Reply').first().json.confidence }}\n\nPlease review the draft in Gmail before sending.",
"otherOptions": {}
},
"id": "b1b2c3d4-2002-4000-8000-000000000006",
"name": "Slack Notify",
"type": "n8n-nodes-base.slack",
"typeVersion": 2.1,
"position": [
1500,
300
]
}
],
"connections": {
"Gmail Trigger": {
"main": [
[
{
"node": "Filter Sent Emails",
"type": "main",
"index": 0
}
]
]
},
"Filter Sent Emails": {
"main": [
[
{
"node": "OpenAI Draft Reply",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Draft Reply": {
"main": [
[
{
"node": "Parse Reply",
"type": "main",
"index": 0
}
]
]
},
"Parse Reply": {
"main": [
[
{
"node": "Create Gmail Draft",
"type": "main",
"index": 0
}
]
]
},
"Create Gmail Draft": {
"main": [
[
{
"node": "Slack Notify",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
AI Smart Reply Generator. Uses gmailTrigger, openAi, gmail, slack. Event-driven trigger; 6 nodes.
Source: https://github.com/mlnjsh/n8n-workflows-mega/blob/main/workflows/ai-email/02-smart-reply-generator.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.
n8n Recruitment. Uses gmailTrigger, openAi, googleSheets, gmail. Event-driven trigger; 20 nodes.
AI Email Categorizer. Uses gmailTrigger, openAi, gmail, slack. Event-driven trigger; 6 nodes.
This n8n template automatically processes inbound form leads, researches their company via their website, and uses AI to write and send a highly personalized "speed to lead" email instantly. It also t
Send A Chatgpt Email Reply And Save Responses To Google Sheets. Uses openAi, gmailTrigger, stickyNote, gmail. Event-driven trigger; 49 nodes.
Code. Uses openAi, gmailTrigger, stickyNote, gmail. Event-driven trigger; 49 nodes.