Triage emails and draft Gmail replies using Gemini and Google Calendar

Go to Workflow
99 views
Built by Allan Vaccarizi Allan Vaccarizi
Created on June 05, 2026

Description

Who it's for

This workflow is for professionals and small business owners who receive a high volume of emails and want to automate triage, labeling, and draft reply generation — without losing the human touch before sending.

How it works

A Gmail trigger polls the inbox every minute for new unread emails and retrieves the current date.
The full email message is fetched, and any existing processing labels are stripped from the thread.
A Gemini 2.5 Pro AI Agent reads the email (and the full thread via a Gmail Thread tool), checks Google Calendar for availability, then classifies the email into one of six categories (Urgent, Reply, Read, Notification, Newsletter, Invoice) and drafts an HTML reply when needed.
A Switch node routes the output: emails requiring a reply (Urgent or Reply) pass through a JavaScript node that appends an HTML signature before saving the message as a Gmail draft.
All paths converge to fetch the matching Gmail label, filter for validity, apply it to the thread, and mark the message as unread so it surfaces for human review.

How to set up

[ ] Connect a Gmail OAuth2 credential to all Gmail nodes (trigger, fetch, remove label, draft, label, mark unread)
[ ] Connect a Google Gemini (PaLM) API credential to the Gemini Chat Model node
[ ] Connect a Google Calendar OAuth2 credential to the Google Calendar Tool node
[ ] Configure the Gmail Trigger label/filter to match your inbox setup
[ ] Update the label IDs in Remove Label from Thread, Get label for response, and Labelliser to match your Gmail labels
[ ] Customize the HTML signature in the Build HTML Signature code node

Requirements

Gmail account with OAuth2 access
Google Gemini (PaLM) API key
Google Calendar account

How to customize

Adjust the AI Agent's system prompt to change tone, add new label categories, or modify the reply structure.
Extend the Switch node with additional branches (e.g., forward to a team member, archive automatically, create a CRM task).
Replace the Gmail draft step with a direct send for fully automated responses on low-risk categories like Notifications.

Nodes Used (5)

AI Agent
@n8n/n8n-nodes-langchain.agent
Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured