How to Connect n8n to Gmail: The Complete Integration Guide (2025)

Email is still where business happens — and it's still where hours disappear. Connecting n8n to Gmail lets you trigger workflows on incoming mail, send and draft messages programmatically, sort with labels, and layer AI on top to classify and reply. This guide covers the full integration and the automations that pay for themselves.

What you can automate with Gmail + n8n

With Gmail wired into n8n you can auto-classify and label incoming email, draft AI replies for a human to approve, route messages to Slack or a CRM, send transactional and follow-up emails, parse attachments into structured data, and build alert systems that watch for specific senders or keywords. It turns a passive inbox into a workflow trigger.

Step 1 — Enable the Gmail API and OAuth

In the Google Cloud Console, create or select a project and enable the Gmail API. Configure the OAuth consent screen, then create an OAuth client ID (Web application) and register n8n's redirect URL. For most single-account setups, OAuth2 is the right choice; larger orgs may prefer a service account with domain-wide delegation.

Step 2 — Connect your account in n8n

Create a Gmail OAuth2 credential in n8n, paste your client ID and secret, and click Connect my account. Grant the requested Gmail scopes. n8n stores a refresh token, so you authorize once and the connection persists.

Step 3 — Trigger on new email

The Gmail Trigger node polls your inbox and emits new messages matching filters you set — by label, sender, subject, or search query. Use a Gmail search filter (like is:unread from:leads@) to fire only on the emails that matter, which keeps your workflow lean and avoids processing newsletters and noise.

⚡ Skip the build — get the ready-made template

This template reads every incoming Gmail message, classifies it, and writes a ready-to-send draft reply — the ultimate payoff of connecting n8n to Gmail.

Get "AI Email Triage — Gmail Auto-Classifier & Draft Generator" on Gumroad →

Step 4 — Send, reply, and draft

The Gmail node supports Send, Reply, Create Draft, and label operations. For AI-assisted email, the winning pattern is Create Draft rather than Send — n8n writes the reply and leaves it in your Gmail drafts for a quick human review before it goes out. You get the speed of automation without the risk of an AI email you didn't see.

Step 5 — Work with labels and threads

Labels are Gmail's automation superpower. Use the node to apply labels for triage (e.g. Sales, Support, Urgent), which lets you build downstream filters and keeps your inbox self-organizing. When replying, pass the original thread ID so your message threads correctly instead of starting a new conversation.

A real example: AI inbox triage

The highest-value Gmail automation reads each new message, sends it to an AI node that classifies intent and urgency, applies the right label, and drafts a contextual reply. You open Gmail to a sorted inbox with drafts already waiting — often cutting email time in half. It's the clearest example of Gmail plus n8n plus AI working together.

Troubleshooting

If the trigger never fires, verify the Gmail API is enabled and your search filter actually matches messages. Hitting quota errors usually means your poll interval is too aggressive — Gmail has generous but real limits. And if replies start new threads, you forgot to pass the thread ID from the triggering message.


Ready to automate? Get this template on Gumroad →

Download the n8n workflow now

Import the JSON, plug in your credentials, and it runs in minutes.