Gmail + Google Calendar: replies and meetings handled
Your inbox doesn’t get “busy” all at once. It leaks time in small, annoying ways: you reread threads, hunt for context, then open your calendar just to realize the week is already packed.
Marketing managers feel it when partners want quick answers. Agency owners feel it when every client email tries to turn into a meeting. And if you run a small business, you already know the pain. This Gmail calendar automation labels emails, summarizes threads, drafts replies, and proposes real meeting slots without you babysitting it.
Below you’ll see what the workflow does, what results to expect, and how the moving pieces fit together so you can confidently customize it.
How This Automation Works
Here’s the complete workflow you’ll be setting up:
n8n Workflow Template: Gmail + Google Calendar: replies and meetings handled
flowchart LR
subgraph sg0["When chat message received Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "When chat message received", pos: "b", h: 48 }
n1@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model", pos: "b", h: 48 }
n2@{ icon: "mdi:memory", form: "rounded", label: "Window Buffer Memory", pos: "b", h: 48 }
n3@{ icon: "mdi:play-circle", form: "rounded", label: "When Executed by Another Wor..", pos: "b", h: 48 }
n4@{ icon: "mdi:cog", form: "rounded", label: "sessionId-master", pos: "b", h: 48 }
n5@{ icon: "mdi:message-outline", form: "rounded", label: "Get last emails", pos: "b", h: 48 }
n6@{ icon: "mdi:location-exit", form: "rounded", label: "Get calendar events", pos: "b", h: 48 }
n14@{ icon: "mdi:vector-polygon", form: "rounded", label: "Embeddings OpenAI1", pos: "b", h: 48 }
n15@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model1", pos: "b", h: 48 }
n16@{ icon: "mdi:message-outline", form: "rounded", label: "Delete an email", pos: "b", h: 48 }
n17@{ icon: "mdi:message-outline", form: "rounded", label: "Create an Email Draft as res..", pos: "b", h: 48 }
n18@{ icon: "mdi:message-outline", form: "rounded", label: "Create an New Email Draft", pos: "b", h: 48 }
n19@{ icon: "mdi:location-exit", form: "rounded", label: "Add an calender entry", pos: "b", h: 48 }
n23@{ icon: "mdi:message-outline", form: "rounded", label: "Get an email by MessageID", pos: "b", h: 48 }
n24@{ icon: "mdi:wrench", form: "rounded", label: "Research context and infos i..", pos: "b", h: 48 }
n26@{ icon: "mdi:robot", form: "rounded", label: "EMail Agent", pos: "b", h: 48 }
n30@{ icon: "mdi:memory", form: "rounded", label: "Threads History Vector Store", pos: "b", h: 48 }
n31@{ icon: "mdi:cog", form: "rounded", label: "Determine the name of the da..", pos: "b", h: 48 }
n16 -.-> n26
n5 -.-> n26
n4 --> n26
n1 -.-> n26
n14 -.-> n30
n15 -.-> n24
n6 -.-> n26
n2 -.-> n26
n19 -.-> n26
n18 -.-> n26
n23 -.-> n26
n0 --> n4
n30 -.-> n24
n3 --> n4
n31 -.-> n26
n17 -.-> n26
n24 -.-> n26
end
subgraph sg1["When clicking ‘Test workflow’ Flow"]
direction LR
n7@{ icon: "mdi:play-circle", form: "rounded", label: "When clicking ‘Test workflow’", pos: "b", h: 48 }
n8@{ icon: "mdi:message-outline", form: "rounded", label: "Gmail - get recent Threads", pos: "b", h: 48 }
n9@{ icon: "mdi:message-outline", form: "rounded", label: "Gmail1", pos: "b", h: 48 }
n10@{ icon: "mdi:vector-polygon", form: "rounded", label: "Embeddings OpenAI", pos: "b", h: 48 }
n11@{ icon: "mdi:robot", form: "rounded", label: "Default Data Loader", pos: "b", h: 48 }
n12@{ icon: "mdi:robot", form: "rounded", label: "Token Splitter", pos: "b", h: 48 }
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Code - Summarize Email Threa.."]
n20@{ icon: "mdi:play-circle", form: "rounded", label: "Gmail Trigger", pos: "b", h: 48 }
n21@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model2", pos: "b", h: 48 }
n22@{ icon: "mdi:message-outline", form: "rounded", label: "Gmail label as kunde", pos: "b", h: 48 }
n25@{ icon: "mdi:message-outline", form: "rounded", label: "Gmail - Label as Colleges", pos: "b", h: 48 }
n27@{ icon: "mdi:robot", form: "rounded", label: "Classify Emails", pos: "b", h: 48 }
n28@{ icon: "mdi:memory", form: "rounded", label: "Write - Threads History Vect..", pos: "b", h: 48 }
n29@{ icon: "mdi:memory", form: "rounded", label: "Read- Threads History Vector..", pos: "b", h: 48 }
n9 --> n13
n20 --> n27
n20 --> n8
n12 -.-> n11
n27 --> n25
n27 --> n22
n10 -.-> n29
n10 -.-> n28
n21 -.-> n27
n11 -.-> n28
n8 --> n9
n7 --> n8
n13 --> n28
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0,n3,n7,n20 trigger
class n26,n11,n12,n27 ai
class n1,n15,n21 aiModel
class n24 ai
class n2,n30,n28,n29 ai
class n14,n10 ai
class n13 code
classDef customIcon fill:none,stroke:none
class n13 customIcon
Why This Matters: Email Back-and-Forth Kills Your Day
Email doesn’t just take time. It breaks your focus. You open one message “real quick,” then you’re deep in a six-email thread trying to remember who promised what, which doc link is current, and whether you already offered Tuesday at 2. Then the calendar dance starts: you check availability, propose a time, get a counter-proposal, and repeat. Multiply that by a handful of threads per day and you’ve quietly lost an hour or two, plus the mental overhead of tracking it all.
It adds up fast. Here’s where it usually breaks down.
- Important customer threads get buried because nothing is consistently labeled or prioritized.
- You end up rewriting the same “Thanks for reaching out…” replies, and they still miss key context from earlier in the thread.
- Scheduling takes forever because “Are you free?” emails ignore real calendar conflicts until the last minute.
- When you’re moving fast, it’s easy to reference the wrong message, time zone, or meeting details and look sloppy.
What You’ll Build: An AI Email + Scheduling Assistant in n8n
This workflow acts like a lightweight assistant that lives between Gmail and Google Calendar. When a new email hits your inbox, it classifies the message using an OpenAI chat model and applies the right label (for example, customer vs. colleague). If the thread needs attention, it pulls the recent thread messages, summarizes the conversation in plain language, and keeps that history available for later so your drafts don’t sound like they forgot what happened yesterday. When scheduling comes up, it checks Google Calendar for conflicts, figures out realistic free slots, and proposes times that actually work. You can also talk to it via Telegram to ask for summaries, draft a response, or sanity-check meeting options.
The workflow starts from Gmail (new email) or a chat message (Telegram). From there, it fetches thread context, uses AI to classify and draft, and consults Google Calendar before it suggests meeting times or creates an event. Finally, it writes the output back where you need it: Gmail labels, Gmail drafts, and calendar events.
What You’re Building
| What Gets Automated | What You’ll Achieve |
|---|---|
|
|
Expected Results
Say you handle 15 meaningful email threads in a day. If you spend maybe 6 minutes rereading context and another 6 minutes drafting a decent reply, that’s about 3 hours of inbox time. Add two scheduling threads (often 10 minutes each, because you check conflicts and propose times) and you’re closer to 3.5 hours. With this workflow, most of that becomes review time: skim a summary, tweak a draft, send, and move on. For many teams that’s roughly 2 hours back on a busy day.
Before You Start
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Gmail for reading threads, drafting replies, labeling emails.
- Google Calendar to check conflicts and propose meeting slots.
- OpenAI API key (get it from your OpenAI dashboard)
Skill level: Intermediate. You’ll connect credentials, set a few labels, and adjust prompts, but you won’t be writing “real code” unless you want to.
Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).
Step by Step
A new email (or a chat request) kicks things off. The workflow can start from a Gmail inbox trigger when new mail arrives, or from a Telegram message when you want the assistant on demand.
The workflow pulls context from Gmail threads. It retrieves the thread, fetches message details, then condenses the text into a summary that’s actually readable. That summary can also be stored so the next time a related email arrives, the assistant “remembers” what happened.
AI decides what to do next. Using an OpenAI chat model, the workflow classifies the message (customer vs. colleague labels, priority cues) and can draft a reply that matches the conversation, not just the latest email.
Google Calendar is consulted for real scheduling options. It pulls calendar events, checks for conflicts, formats weekday names, and proposes open slots (including time zone handling) so you’re not offering times you can’t keep.
You can easily modify the labeling rules and drafting tone to fit your business, then expand the meeting logic to match how you schedule. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Chat Trigger
Set up the conversational entry points that feed user requests into the assistant.
- Add and configure Chat Message Intake as your primary trigger for chat-based requests.
- Keep Triggered by Workflow Run to allow other workflows to pass sessionId and chatInput into this assistant.
- Connect both Chat Message Intake and Triggered by Workflow Run to Session Key Relay.
Step 2: Configure Inbox Monitoring and Parallel Processing
Enable the inbox trigger and ensure parallel categorization and thread retrieval run correctly.
- Configure Gmail Inbox Trigger with polling set to everyMinute.
- Credential Required: Connect your gmailOAuth2 credentials in Gmail Inbox Trigger.
- Connect Gmail Inbox Trigger so that it outputs to both Categorize Emails and Retrieve Gmail Threads in parallel.
- In Categorize Emails, set Input Text to
=Email Subject: {{ $json.Subject }} EMail From: {{ $json.From }} ------ ##Email Snippet: {{ $json.snippet }}.
Credential Required: Connect your openAiApi credentials in Classifier Chat Model. This model powers Categorize Emails as the language model.
Step 3: Apply Labels Based on Classification
Route classified emails to the correct label actions.
- From Categorize Emails, route the first output to Apply Colleague Label and the second output to Apply Customer Label.
- In Apply Colleague Label, set Message ID to
{{ $json.id }}and add your label ID in Label IDs. - In Apply Customer Label, set Message ID to
{{ $json.id }}and add your label ID in Label IDs. - Credential Required: Connect your gmailOAuth2 credentials in both Apply Colleague Label and Apply Customer Label.
Step 4: Retrieve and Summarize Email Threads
Pull full thread data and convert it into a structured summary for storage and retrieval.
- Configure Retrieve Gmail Threads with Resource set to
thread. - In Fetch Thread Details, set Resource to
thread, Operation toget, and Thread ID to{{ $json.id }}. - Connect Fetch Thread Details to Summarize Thread Text and keep the JavaScript code intact to generate
emailSummary. - Connect Summarize Thread Text to Store Thread History for vector storage.
- Credential Required: Connect your gmailOAuth2 credentials in Retrieve Gmail Threads and Fetch Thread Details.
⚠️ Common Pitfall: Ensure your Gmail account has thread access enabled; missing thread IDs will prevent Fetch Thread Details from returning messages.
Step 5: Configure Vector Memory and Document Processing
Chunk and embed summarized email content for retrieval by the assistant.
- In Token Chunk Splitter, set Chunk Size to
2000and connect it to Standard Data Loader. - In Standard Data Loader, set JSON Data to
{{ $json.emailSummary }}and include metadata threadId as{{ $json.id }}. - In Store Thread History, set Mode to
insertand Clear Store totrue. - In Load Thread History, set Mode to
load, Top K to100, and Prompt toworkshop.
Credential Required: Connect your openAiApi credentials in OpenAI Embeddings and OpenAI Embeddings B. These embeddings power Store Thread History, Load Thread History, and Thread History Store.
Step 6: Configure the AI Assistant and Tools
Set the agent, memory, and tool connections that drive inbox and calendar actions.
- In Inbox Assistant Agent, set Text to
{{ $json.chatInput }}and keep the full system message in Options → System Message. - In Context Window Memory, set Session Key to
{{ $('Session Key Relay').item.json.sessionId }}and Context Window Length to10. - Ensure Primary Chat Model is connected as the language model for Inbox Assistant Agent.
- Ensure Secondary Chat Model is connected as the language model for Search Past Conversations.
- Keep Search Past Conversations, Fetch Recent Emails, Retrieve Calendar Events, Add Calendar Event, Fetch Email by ID, Draft Reply to Thread, Create New Draft, Remove Email Message, and Format Weekday Name connected as tools to Inbox Assistant Agent.
Credential Required: Connect your openAiApi credentials in Primary Chat Model and Secondary Chat Model. These models power agent reasoning and retrieval.
Credential Required: Connect your gmailOAuth2 credentials to the Gmail tool nodes (5+ nodes handle fetching, drafting, and deleting). Credentials are applied on each Gmail tool node, not inside the agent.
Credential Required: Connect your googleCalendarOAuth2Api credentials in Retrieve Calendar Events and Add Calendar Event. These tools are invoked by Inbox Assistant Agent.
Tip: For AI tools like Search Past Conversations and Context Window Memory, credentials are added to the parent nodes (Secondary Chat Model and Primary Chat Model), not the tool sub-nodes.
Step 7: Configure Manual Testing and Thread Ingestion
Enable manual runs to validate thread retrieval and summarization without waiting for new emails.
- Connect Manual Test Trigger directly to Retrieve Gmail Threads.
- Confirm the execution chain: Retrieve Gmail Threads → Fetch Thread Details → Summarize Thread Text → Store Thread History.
Step 8: Test & Activate Your Workflow
Validate both the chat-driven assistant and the inbox automation before going live.
- Click Execute Workflow and use Manual Test Trigger to verify email thread ingestion completes with summaries stored in Store Thread History.
- Send a test message through Chat Message Intake and confirm Inbox Assistant Agent responds with tool-based insights (emails, calendar, or drafts).
- Check Gmail to confirm labels were applied by Apply Colleague Label or Apply Customer Label when Gmail Inbox Trigger fires.
- When satisfied, toggle the workflow to Active to begin continuous inbox and calendar automation.
Troubleshooting Tips
- Gmail credentials can expire or lack the right scopes. If drafts or labels aren’t being created, check the Gmail credential in n8n first and re-authenticate.
- If you’re using Wait nodes or external processing (like vector store lookups), processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- OpenAI prompts are often too generic out of the box. Add your brand voice and “what not to say” early, or you’ll be cleaning up bland drafts forever.
Quick Answers
About 45 minutes if your Gmail, Calendar, and OpenAI accounts are ready.
No coding required. You’ll mostly connect accounts, set labels, and tweak the AI prompts.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs (often a few cents per day at light usage).
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you should. You can swap the “Categorize Emails” and “Classifier Chat Model” behavior to match your labels, then adjust the “Draft Reply to Thread” prompt to enforce tone, structure, and signature. Common customizations include adding a “VIP” label, drafting different templates for sales vs. support, and only proposing meeting slots when the email contains scheduling language.
Usually it’s expired Gmail authorization or missing permissions for drafts/labels. Reconnect the Gmail credential in n8n, then rerun using the Manual Test Trigger to confirm Gmail nodes can list threads and create drafts. If it still fails, check Google Workspace admin restrictions (common in managed company accounts) and watch for rate limits when you process a lot of threads at once.
It depends on your n8n plan and how often you trigger summaries, but dozens of emails per day is normal for a single inbox.
Often, yes, because this workflow relies on multi-step logic, memory, and thread context, which gets expensive or awkward in simpler automation tools. n8n also gives you a self-hosting option, so you’re not paying more just because your inbox got busy this month. The other big win is flexibility: you can branch for different labels, add approvals, or route summaries to Telegram without fighting the platform. Zapier or Make can still be fine for basic “email → create event” automations, especially if you want the quickest possible setup and don’t care about context. If you’re unsure, Talk to an automation expert and we’ll map the simplest path.
This is the kind of automation you set up once and then quietly benefit from every day. Your inbox stays readable, replies get easier, and scheduling stops being a mini-project.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.