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": "AI Gmail Out of Office Auto-Responder",
"tags": [],
"nodes": [
{
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1632,
160
],
"parameters": {
"text": "=You are an Out of Office assistant. Output JSON only.\n\nInputs:\n- from_header: {{ $json.From }}\n- subject: {{ $json.Subject }}\n- snippet: {{ $json.snippet }}\n- return_start: {{ $('Define OOO Dates and Contact').item.json.ooo_start }}\n- return_end: {{ $('Define OOO Dates and Contact').item.json.ooo_end }}\n- timezone: {{ $('Define OOO Dates and Contact').item.json.timezone }}\n- alt_contact_name: {{ $('Define OOO Dates and Contact').item.json.alt_contact_name }}\n- alt_contact_email: {{ $('Define OOO Dates and Contact').item.json.alt_contact_email }}\n- id: {{ $json.id }}\n\nGoal:\nWrite a concise, warm reply that sounds like a real person and helps the sender move forward while I am away.\n\nStyle and language:\n- Use Spanish English.\n- Mirror the sender\u2019s language if subject or snippet is clearly another language.\n- Be friendly and clear. No corporate clich\u00e9s. No em dashes.\n- Max 100 words.\n\nPersonalisation:\n- Extract the sender\u2019s first name from from_header if possible. If not, use a neutral greeting like \u201cHi there\u201d.\n- If subject indicates a meeting or request, acknowledge it directly.\n\nDecision rules:\n1) If this appears to be a newsletter, marketing blast, receipt, OTP, calendar bot, or any automated system message, set \"should_reply\": false.\n2) Else set \"should_reply\": true.\n3) For internal colleagues (same domain as mine), keep tone casual-professional and suggest a simple next step.\n4) For clients or external senders, keep tone professional-warm and include a specific next step or alternate contact.\n\nContent rules when replying:\n- State clearly when I will be back using local dates based on timezone.\n- Offer a useful next step. Examples: email {{ $('Define OOO Dates and Contact').item.json.alt_contact_email }} for urgent items, propose they send any decisions or files so I can review on return, or suggest booking time after the return date if appropriate.\n- Do not promise action while away. No images, signatures, or links other than the alternate contact email.\n- Keep paragraphs short. Use simple <p> paragraphs in body_html.\n\nOutput JSON only in this schema:\n{\n \"should_reply\": boolean,\n \"subject\": \"string\",\n \"body_html\": \"string\",\n \"id\": \"string\"\n}\n\nSubject rule:\n- If replying, subject should usually be \"Re: {{ $json.Subject }}\". If the original subject already contains Re:, keep it as is.\n\nBody quality checklist before finalising:\n- Friendly opener like \u201cThanks for reaching out\u201d or \u201cAppreciate the note\u201d.\n- One clear sentence stating I am away and the return date.\n- One sentence with the next step or alternate contact ({{ $('Define OOO Dates and Contact').item.json.alt_contact_name }} at {{ $('Define OOO Dates and Contact').item.json.alt_contact_email }}).\n- Optional brief reassurance line like \u201cI\u2019ll get back to you after I return.\u201d\n- Convert new lines to <p> blocks in body_html.",
"promptType": "define"
},
"typeVersion": 2.2
},
{
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1648,
384
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "gpt-4o-mini"
}
},
"typeVersion": 1.2
},
{
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1776,
384
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"title\": \"AI Out of Office Reply\",\n \"type\": \"object\",\n \"properties\": {\n \"should_reply\": {\n \"type\": \"boolean\"\n },\n \"subject\": {\n \"type\": \"string\"\n },\n \"body_html\": {\n \"type\": \"string\"\n },\n \"id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\"should_reply\", \"subject\", \"body_html\", \"id\"],\n \"additionalProperties\": false\n}"
},
"typeVersion": 1.3
},
{
"name": "Check Email on Schedule",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
288,
288
],
"parameters": {
"rule": {
"interval": [
{
"field": "minutes"
}
]
}
},
"typeVersion": 1.2
},
{
"name": "Define OOO Dates and Contact",
"type": "n8n-nodes-base.set",
"position": [
512,
288
],
"parameters": {
"values": {
"string": [
{
"name": "ooo_start",
"value": "2025-08-19T07:00:00+02:00"
},
{
"name": "ooo_end",
"value": "2025-08-27T18:00:00+02:00"
},
{
"name": "timezone",
"value": "Europe/Madrid"
},
{
"name": "alt_contact_name",
"value": "Your teammate"
},
{
"name": "alt_contact_email",
"value": "user@example.com"
}
]
}
},
"typeVersion": 2
},
{
"name": "Check If Currently OOO",
"type": "n8n-nodes-base.if",
"position": [
736,
288
],
"parameters": {
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "dateTime",
"operation": "after"
},
"leftValue": "={{$now.toISO()}}",
"rightValue": "={{$json.ooo_start}}"
},
{
"operator": {
"type": "dateTime",
"operation": "before"
},
"leftValue": "={{$now.toISO()}}",
"rightValue": "={{$json.ooo_end}}"
}
]
}
},
"typeVersion": 2
},
{
"name": "Get Unread Emails",
"type": "n8n-nodes-base.gmail",
"position": [
960,
288
],
"parameters": {
"filters": {
"readStatus": "unread"
},
"operation": "getAll"
},
"typeVersion": 2.1
},
{
"name": "Process Each Email",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1184,
288
],
"parameters": {},
"typeVersion": 3
},
{
"name": "Fetch Email Content",
"type": "n8n-nodes-base.gmail",
"position": [
1408,
160
],
"parameters": {
"messageId": "={{$json.id}}",
"operation": "get"
},
"typeVersion": 2.1
},
{
"name": "Decide If Reply Is Needed",
"type": "n8n-nodes-base.if",
"position": [
1984,
160
],
"parameters": {
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.output.should_reply }}"
}
]
}
},
"typeVersion": 2
},
{
"name": "Send AI-Powered Auto-Reply",
"type": "n8n-nodes-base.gmail",
"position": [
2208,
160
],
"parameters": {
"message": "={{ $json.output.body_html }}",
"messageId": "={{ $json.output.id }}",
"operation": "reply"
},
"typeVersion": 2.1
},
{
"name": "Tag Replied Emails",
"type": "n8n-nodes-base.gmail",
"position": [
2432,
288
],
"parameters": {
"labelIds": [
"Label_Replace_With_Your_Label_ID"
],
"messageId": "={{$json.id}}",
"operation": "addLabels"
},
"typeVersion": 2
},
{
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
432,
32
],
"parameters": {
"color": 5,
"width": 256,
"height": 512,
"content": "### \ud83d\uddd3\ufe0f Set your OOO dates and contact info\n\n- Set the values for ooo_start and ooo_end in ISO 8601 format (e.g., 2025-08-19T07:00:00+02:00)\n- Your local timezone (e.g., Europe/Madrid)\n- A fallback contact\u2019s name and email"
},
"typeVersion": 1
},
{
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
2368,
48
],
"parameters": {
"color": 5,
"width": 304,
"height": 448,
"content": "### \ud83c\udff7\ufe0f Replace label ID with your own Gmail label\n\n\u2022 In this node, replace the current labelIds value with one from your Gmail account.\n\u2022 You can create a new label like \u201cAuto-Replied\u201d and copy its ID from Gmail settings."
},
"typeVersion": 1
},
{
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
112,
32
],
"parameters": {
"color": 5,
"width": 304,
"height": 512,
"content": "### \ud83d\udd01 Adjust how often the workflow runs\n\n\u2022 In the Schedule Trigger node, update the time interval to control how frequently it checks emails."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"connections": {
"AI Agent": {
"main": [
[
{
"node": "Decide If Reply Is Needed",
"type": "main",
"index": 0
}
]
]
},
"Get Unread Emails": {
"main": [
[
{
"node": "Process Each Email",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Process Each Email": {
"main": [
[
{
"node": "Fetch Email Content",
"type": "main",
"index": 0
}
]
]
},
"Tag Replied Emails": {
"main": [
[
{
"node": "Process Each Email",
"type": "main",
"index": 0
}
]
]
},
"Fetch Email Content": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Check If Currently OOO": {
"main": [
[
{
"node": "Get Unread Emails",
"type": "main",
"index": 0
}
]
]
},
"Check Email on Schedule": {
"main": [
[
{
"node": "Define OOO Dates and Contact",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Decide If Reply Is Needed": {
"main": [
[
{
"node": "Send AI-Powered Auto-Reply",
"type": "main",
"index": 0
}
]
]
},
"Send AI-Powered Auto-Reply": {
"main": [
[
{
"node": "Tag Replied Emails",
"type": "main",
"index": 0
}
]
]
},
"Define OOO Dates and Contact": {
"main": [
[
{
"node": "Check If Currently OOO",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
How this works
This workflow delivers an intelligent out-of-office auto-responder for your Gmail inbox, crafting personalised replies that acknowledge emails during your absence and suggest alternatives like a colleague's contact. It suits busy professionals or teams needing seamless communication without manual intervention, saving hours on email management. The key step involves an AI agent powered by OpenAI's chat model analysing incoming unread emails, applying a structured output parser to generate context-aware responses, and sending them via Gmail integration.
Use this when you're on holiday or unavailable for extended periods and want AI-driven replies that feel human rather than generic. Avoid it for short absences under a day, where manual handling or Gmail's built-in auto-responder suffices, or if your emails require sensitive data processing beyond basic AI capabilities. Common variations include customising the AI prompt for industry-specific tones or integrating with calendars like Google Calendar to dynamically adjust out-of-office dates.
About this workflow
AI Gmail Out of Office Auto-Responder. Uses agent, lmChatOpenAi, outputParserStructured, scheduleTrigger. Scheduled trigger; 15 nodes.
Source: https://github.com/ScraperNode/awesome-n8n-templates/blob/main/templates/ai-and-llm/7625-smart-gmail-auto-replies-while-out-of-office-with-ai/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.
This n8n automation workflow automates the creation, scripting, production, and posting of YouTube videos. It leverages AI (OpenAI), image generation (PIAPI), video rendering (Shotstack), and platform
Created by: Peyton Leveillee Last updated: October 2025
Generate SEO-friendly WordPress blog drafts from a Google Sheets queue using OpenAI. This workflow writes full HTML blog content, selects a relevant Pexels featured image with a second AI Agent, uploa
AI SEO Blog Generator. Uses httpRequest, agent, googleSheets, gmail. Scheduled trigger; 58 nodes.
SEO Blog Article Generation Workflow. Uses outputParserStructured, httpRequest, agent, lmChatOpenAi. Scheduled trigger; 56 nodes.