n8n Gmail Auto Responder
Overview
n8n Gmail Auto Responder
This n8n Gmail Auto Responder workflow listens for new Gmail messages, determines whether a reply is necessary, and—if so—uses Google Gemini AI to draft a professional response and save it as a draft in your Gmail account.
📌 Use Cases
- Customer service email automation
- First-response for business or partnership inquiries
- Freelancers or remote workers handling large email volumes
🧩 Key Nodes
- Gmail Trigger – Monitors incoming emails
- Google Gemini Chat Model – Analyzes intent and generates replies
- JSON Parser – Parses the AI output
- If Condition – Determines if a response is needed
- Gmail – Create Draft – Saves the generated reply as a Gmail draft
⚠️ Notes
- Currently filters out your own emails with
-from:me
- Make sure Gmail OAuth2 and Google Gemini API credentials are properly configured
- The reply is saved as a draft—review it before sending
- You can customize the Gemini prompt to suit your tone or industry
Workflow Editor Screenshot

Workflow JSON Code
{ "name": "gmail auto responder", "nodes": [ { "parameters": { "pollTimes": { "item": [ { "mode": "everyHour" } ] }, "simple": false, "filters": { "q": "-from:me" }, "options": {} }, "id": "18db4782-1b91-4a11-8a4e-fc5f8dd3ff5f", "name": "Gmail Trigger", "type": "n8n-nodes-base.gmailTrigger", "position": [ -920, 420 ], "typeVersion": 1, "credentials": { "gmailOAuth2": { "id": "dzDESvbzqxPW59mo", "name": "Gmail account" } } }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 1 }, "conditions": [ { "id": "53849246-ad32-4845-9976-9f9688f5a6f2", "operator": { "type": "boolean", "operation": "true", "singleValue": true }, "leftValue": "={{ $json.needsReply }}", "rightValue": "true" } ], "combinator": "and" }, "options": {} }, "id": "5ffe0d08-9725-4452-aa3d-ec420d40d999", "name": "If Needs Reply", "type": "n8n-nodes-base.if", "position": [ -260, 420 ], "typeVersion": 2 }, { "parameters": { "jsonSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"needsReply\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\"needsReply\"]\n}\n" }, "id": "046a8a02-40f4-48d6-b2aa-4f75d9e1831f", "name": "JSON Parser", "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "position": [ -400, 580 ], "typeVersion": 1 }, { "parameters": { "content": "## Email Arrival Trigger\n", "height": 414, "width": 304 }, "id": "22c67a9f-f3db-4a7c-b21d-961a5511b8f7", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ -1000, 300 ], "typeVersion": 1 }, { "parameters": { "content": "## Determine if Reply is Needed\n", "height": 417, "width": 556 }, "id": "0828a525-cbf6-4868-9450-1e2e0bb086a6", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ -660, 300 ], "typeVersion": 1 }, { "parameters": { "content": "## Generate Email Response", "height": 420, "width": 333 }, "id": "ba9391fd-313a-4b9b-969d-9360c5f11948", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ -40, 300 ], "typeVersion": 1 }, { "parameters": { "content": "## Save Response as Draft", "height": 415, "width": 326 }, "id": "ac5efd51-42be-45cd-a7f9-af3dbc0e5f7c", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ 320, 300 ], "typeVersion": 1 }, { "parameters": { "resource": "draft", "subject": "=Re: {{ $('Gmail Trigger').item.json.headers.subject }}", "emailType": "html", "message": "={{ $json.text.replace(/\\n/g, \"<br />\\n\") }}", "options": { "threadId": "={{ $('Gmail Trigger').item.json.threadId }}", "sendTo": "={{ $('Gmail Trigger').item.json.headers.from }}" } }, "id": "3a39d4ec-e476-481b-a959-53195774f40d", "name": "Gmail - Create Draft", "type": "n8n-nodes-base.gmail", "position": [ 400, 400 ], "typeVersion": 2.1, "webhookId": "f6825e31-2295-444f-a9db-19df032ba67a", "credentials": { "gmailOAuth2": { "id": "dzDESvbzqxPW59mo", "name": "Gmail account" } } }, { "parameters": { "prompt": "=Subject: {{ $json.subject }}\nMessage:\n{{ $json.textAsHtml }} ", "messages": { "messageValues": [ { "message": "Your task is to assess if the message requires a response. Return in JSON format true if it does, false otherwise.\nMarketing emails don't require a response." } ] } }, "id": "23999eaa-35be-4af0-97e2-d631ead61dbc", "name": "Assess if message needs a reply", "type": "@n8n/n8n-nodes-langchain.chainLlm", "position": [ -600, 420 ], "typeVersion": 1.3 }, { "parameters": { "promptType": "define", "text": "=Subject: {{ $('Gmail Trigger').item.json.subject }}\nMessage: {{ $('Gmail Trigger').item.json.textAsHtml }}", "messages": { "messageValues": [ { "message": "You're a helpful personal assistant and your task is to draft replies on my behalf to my incoming emails. Whenever I provide some text from an email, return an appropriate draft reply for it and nothing else.\nEnsure that the reply is suitable for a professional email setting and addresses the topic in a clear, structured, and detailed manner.\nDo not make things up.\n\nDetailed instructions:\n- Be concise and maintain a business casual tone.\n- Start with \"Hello,\", and end with \"Best,\"\n- When replying to yes-no questions, draft 2 responses: one affirmative and one negative separated by \" - - - - - - - OR - - - - - - - \"\n- If you don't know an answer, you can leave placeholders like \"[YOUR_ANSWER_HERE]\".\n- Don't use any special formatting, only plain text.\n- Reply in the same language as the inbound email." } ] } }, "id": "6ced7d6d-ac3b-4faa-86c7-424298df723f", "name": "Generate email reply", "type": "@n8n/n8n-nodes-langchain.chainLlm", "position": [ 0, 400 ], "typeVersion": 1.4 }, { "parameters": { "modelName": "models/gemini-2.5-flash", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "typeVersion": 1, "position": [ -620, 580 ], "id": "f4d5cc64-a0fa-4467-90f2-c7de64fa8988", "name": "Google Gemini Chat Model", "credentials": { "googlePalmApi": { "id": "FNGLZKzZh74EizDF", "name": "Google Gemini(PaLM) Api account" } } }, { "parameters": { "modelName": "models/gemini-2.5-flash", "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "typeVersion": 1, "position": [ 0, 560 ], "id": "0621bc77-24fc-45fe-b841-181f245ea737", "name": "Google Gemini Chat Model1", "credentials": { "googlePalmApi": { "id": "FNGLZKzZh74EizDF", "name": "Google Gemini(PaLM) Api account" } } } ], "pinData": {}, "connections": { "JSON Parser": { "ai_outputParser": [ [ { "node": "Assess if message needs a reply", "type": "ai_outputParser", "index": 0 } ] ] }, "Gmail Trigger": { "main": [ [ { "node": "Assess if message needs a reply", "type": "main", "index": 0 } ] ] }, "If Needs Reply": { "main": [ [ { "node": "Generate email reply", "type": "main", "index": 0 } ] ] }, "Generate email reply": { "main": [ [ { "node": "Gmail - Create Draft", "type": "main", "index": 0 } ] ] }, "Assess if message needs a reply": { "main": [ [ { "node": "If Needs Reply", "type": "main", "index": 0 } ] ] }, "Google Gemini Chat Model": { "ai_languageModel": [ [ { "node": "Assess if message needs a reply", "type": "ai_languageModel", "index": 0 } ] ] }, "Google Gemini Chat Model1": { "ai_languageModel": [ [ { "node": "Generate email reply", "type": "ai_languageModel", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "versionId": "f0d04f72-325e-46be-9dcb-cbe364d314fc", "meta": { "templateCredsSetupCompleted": true, "instanceId": "b58c72a58c801e03c1291a94486621c33c072d68397a812e8c55705976de38d8" }, "id": "IVxQzrGnEbUKPlpS", "tags": [] }