Skip to main content
Community template Uses AITicket ManagementAI Summarization

Triage emails and draft Gmail replies using Gemini and Google Calendar - n8n workflow template

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. 1. A Gmail trigger polls the inbox every minute for new unread…

Template by Allan Vaccarizi · Original listing (opens in a new tab)

Starts on
App event
Nodes
16 nodes
Level
Intermediate
Setup
About 21 min

Workflow preview

How this workflow runs

  1. 1

    When New Email Arrives

    Starts the workflow when a new email arrives in Gmail.

  2. 2

    Google Calendar Tool

    Lets the AI agent read or create Google Calendar events as a tool.

  3. 3

    Gemini Chat Model

    Provides Google Gemini as the chat model for the AI steps.

  4. 4

    Gmail Thread Tool

    Lets the AI agent send email via Gmail as a callable tool.

  5. 5

    Structured Output Parser

    Forces the AI output into a structured JSON schema for reliable downstream use.

  6. 6

    Get Current Date

    Runs custom JavaScript to transform or manipulate the data flowing through the workflow.

  7. 7

    Fetch Email Details

    Sends or reads email through Gmail.

  8. 8

    Remove Label from Thread

    Sends or reads email through Gmail.

  9. 9

    Draft and Label Agent

    The AI agent that orchestrates the workflow — it reasons over the input and decides which tools to call.

  10. 10

    Route by Draft Type

    Routes the workflow down one of several paths based on a value.

Creator's notes and setup

Written by Allan Vaccarizi for the original listing.

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

  1. A Gmail trigger polls the inbox every minute for new unread emails and retrieves the current date.
  2. The full email message is fetched, and any existing processing labels are stripped from the thread.
  3. 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.
  4. 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.
  5. 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.

n8n nodes used (8 types)

What every node does (16)
  • Fetch Email Details (Gmail)Sends or reads email through Gmail.
  • Add Label to Email (Gmail)Sends or reads email through Gmail.
  • When New Email Arrives (Gmail Trigger)Starts the workflow when a new email arrives in Gmail.
  • Send Response Email (Gmail)Sends or reads email through Gmail.
  • Filter Valid Label (Filter)Keeps only the items that match a condition and discards the rest.
  • Draft and Label Agent (Agent)The AI agent that orchestrates the workflow — it reasons over the input and decides which tools to call.
  • Send Draft Email (Gmail)Sends or reads email through Gmail.
  • Route by Draft Type (Switch)Routes the workflow down one of several paths based on a value.
  • Build HTML Signature (Code)Runs custom JavaScript to transform or manipulate the data flowing through the workflow.
  • Get Current Date (Code)Runs custom JavaScript to transform or manipulate the data flowing through the workflow.
  • Remove Label from Thread (Gmail)Sends or reads email through Gmail.
  • Google Calendar Tool (Google Calendar Tool)Lets the AI agent read or create Google Calendar events as a tool.
  • Gemini Chat Model (LLM Chat Google Gemini)Provides Google Gemini as the chat model for the AI steps.
  • Gmail Thread Tool (Gmail Tool)Lets the AI agent send email via Gmail as a callable tool.
  • Structured Output Parser (Output Parser Structured)Forces the AI output into a structured JSON schema for reliable downstream use.
  • Mark Email as Unread (Gmail)Sends or reads email through Gmail.

FAQ

Triage emails and draft Gmail replies using Gemini and Google Calendar: questions

How do I import the "Triage emails and draft Gmail replies using Gemini and Google Calendar" workflow into n8n?

Copy the workflow JSON from this page, open the n8n editor, click on an empty canvas and paste with Ctrl+V (Cmd+V on macOS). You can also download the .json file and choose Import from File in the workflow menu. Save the workflow, then attach credentials before activating it.

Which nodes and credentials does "Triage emails and draft Gmail replies using Gemini and Google Calendar" use?

It uses Switch, Gmail, Gmail Trigger, Code, Filter and Agent, plus 2 more. Any node that connects to an external service needs your own credential — open each node after import and select or create one. Trigger, logic and transformation nodes usually need no credentials.

Can it run on n8n Cloud and on self-hosted n8n?

The workflow format is the same on both. If a node appears as unknown or outdated after import, update n8n to a recent version or, on self-hosted instances, install the required community node package. Features such as $env access are available on self-hosted instances only.

How can I customise "Triage emails and draft Gmail replies using Gemini and Google Calendar"?

Start by changing the trigger (schedule, webhook or app event) and the destination nodes to match your stack — it is listed under Ticket Management, AI Summarization. Edit prompts, field mappings and filters in the relevant nodes, use expressions like {{ $json.field }} to map data, and test with a manual execution before activating.

n8n is a trademark of n8n GmbH. AltFTool is not affiliated with, endorsed by or sponsored by n8n. Community templates are credited to their creators and link to the original listing; AltFTool originals are written and tested by the AltFTool team.

About this page

Free n8n workflow templates to copy and import

The AltFTool n8n library collects free n8n workflow templates for AI agents, Gmail, Google Sheets, Telegram and other apps. Each workflow page shows a preview, the list of nodes and the credentials it needs, and lets you copy or download the JSON to import into your own n8n.

Search the templates by app or task, or browse them by category and by node. The Workflow Inspector checks any workflow JSON for triggers, credentials and hardcoded keys before you share it, and the expressions cheat sheet gives copy-paste n8n expression examples. AltFTool is not affiliated with n8n.

People also search for

  • n8n workflow templates
  • n8n templates
  • n8n automation examples
  • n8n json workflows
  • n8n nodes
  • free n8n workflow templates
  • n8n ai agent template
  • n8n expressions cheat sheet