AI Workflows · Intermediate · ~45 min setup

Automatically Categorize and Summarize Gmail With AI

GmailOpenAIGoogle SheetsTelegramn8n

The fastest DIY way to automatically categorize and summarize Gmail with AI is a single n8n workflow: a Gmail trigger hands every unread email to an OpenAI classifier, which sorts it into one of four lanes — High Priority, Customer Support, Promotions, or Finance. Urgent emails get an AI-drafted reply saved for your approval, support questions get auto-answered from your own FAQ spreadsheet, and everything else gets summarized and filed. It costs a fraction of a cent per email and takes about 45 minutes to set up. No Zapier subscription, no per-task fees.

What this actually does to your inbox

Open Gmail tomorrow morning and instead of 40 unread messages you see:

  • Urgent emails already have a reply drafted — written by AI, sitting in your Drafts, waiting for you to read, tweak, and send. Nothing important goes out without a human.
  • Support questions were answered overnight — the AI looked up the answer in your FAQ sheet and replied in-thread. You see a Telegram ping confirming each one.
  • Promotions are gone — summarized into one line each, labeled, archived.
  • Billing emails were summarized and sent on — to the finance address you configure (our version ships with a placeholder so nothing goes out until you set it).

Every email also gets a Gmail label, so nothing is hidden; it's sorted, not deleted.

Flow diagram: Gmail trigger feeds an OpenAI classifier, which routes each email into one of four lanes — high priority (human-approved drafts), customer support (auto-reply from FAQ sheet), promotions (summarize and archive), finance (summarize and forward) — with Telegram notifications from every lane

The build, lane by lane

The workflow is 43 nodes, but it's four copies of the same simple pattern hanging off one classifier. Here's each piece and the decisions that matter.

1. Intake: the Gmail trigger

A Gmail Trigger node polls for unread messages. Two settings matter: keep the UNREAD only filter on (otherwise it re-processes your whole inbox on first run), and start with the polling interval at a few minutes — you can tighten it later.

2. The classifier: one prompt, structured output

Every email's subject and body go to an OpenAI node acting as a classifier agent. The prompt does two jobs at once: it normalizes the messy email into clean text, and it returns strict JSON like {"classification": "customer_support"}.

The trick that makes this reliable: force JSON output and enumerate the allowed categories in the prompt, with one-line definitions and an example each. Vague category names ("Important", "Other") are where email classifiers go to die. Concrete definitions — "Finance/Billing: invoices, payment confirmations, anything with an amount due" — get you 95%+ accuracy even on a small model like gpt-4o-mini.

A Switch node then reads that JSON field and routes to one of four branches.

3. High Priority lane: human-in-the-loop by design

This is the lane that touches emails that could cost you money or reputation, so it deliberately does not send anything. It labels the email, has OpenAI draft a reply plus a short internal note, saves the reply as a Gmail draft, and pings Telegram. The human stays in the loop exactly where judgment matters.

4. Customer Support lane: RAG from a spreadsheet

The clever part of this template. The support responder is an OpenAI node with a Google Sheets tool attached — when a question comes in, the model can look up your internal Q&A and SOP rows and write an answer grounded in your information, not its general knowledge. That's retrieval-augmented generation with a spreadsheet as the knowledge base: zero vector databases, zero embeddings pipeline, and for a few hundred FAQ rows it works remarkably well.

The reply goes out in-thread automatically. If auto-sending makes you nervous, change the Gmail node's operation from Reply to Create Draft — the rest of the lane is unchanged.

5. Promotions and Finance lanes: summarize and move on

Promotions get a one-line AI summary with a recommended action, then marked read and archived. Finance/Billing emails get summarized into a subject + message and sent onward as a new email. One thing we changed from the original template: it shipped with this node replying to the original sender — meaning your vendors would receive AI summaries of their own invoices. Our version has a placeholder recipient; the guide shows you where to put your bookkeeper's address. Both lanes ping Telegram so decisions leave a trail.

Setup gotchas nobody warns you about

  • Gmail OAuth is the slow part. n8n needs a Google Cloud project with the Gmail API enabled and an OAuth consent screen. Budget 15 of your 45 minutes for this. The full guide below walks through every click.
  • Create the four Gmail labels first. The workflow applies labels by ID; if "High Priority", "Customer Support", "Promotions", and "Finance/Billing" don't exist, those nodes fail.
  • Replace the template's spreadsheet. The Sheets nodes point at the original author's demo sheet. Make your own copy with your own FAQ rows and swap the document ID in two nodes.
  • Telegram is optional. All notification nodes can be deleted with nothing else breaking — or swap them for Slack in two minutes.
  • ⚠️ The template ships with demo utilities — one of them deletes emails. There's a disabled "Send Demo Emails" branch for testing and a "Delete Demo Emails" cleanup branch that removes messages in batches. Leave the cleanup branch disabled on any real account. We flag exactly which nodes in the guide.

What it costs to run

Self-hosted n8n: free (any €4/month VPS or a Raspberry Pi handles this). OpenAI usage with gpt-4o-mini: classification plus one drafted reply lands around $0.001–0.005 per email — a 500-email month costs less than a coffee. Compare that with Zapier, where this many steps across 500 emails would land you in three-figure-per-month territory.

Make it yours

The four categories are just prompt text and switch cases — rename them, add a fifth ("Recruiting"? "Press"?), or route by client instead of by type. Swap OpenAI for Claude or a local model via Ollama if emails can't leave your infrastructure. Point the Finance lane at your accounting inbox. Add a weekly digest node that summarizes what the triage did. The skeleton — classify once, route to per-category handlers — is the reusable part.

Get the workflow, ready to import

Drop your email and we'll send the sanitized n8n workflow file plus the full setup guide: every credential, every gotcha, and prompts you can paste straight in.

No spam. Unsubscribe in one click.

Rather skip the setup? Book a build call →

FAQ

Will it send replies without my approval?
Not for anything important. High-priority emails only get a draft saved in Gmail — a human hits send. The customer-support lane does auto-reply out of the box, but you can switch that node from Send to Create Draft until you trust its answers.
Do I need to pay for n8n?
No. n8n self-hosted is free — a Docker container on any small VPS runs this comfortably. n8n Cloud starts around €20/month if you'd rather not manage a server. The only per-use cost is OpenAI tokens, a fraction of a cent per email.
Can I use Claude or Gemini instead of OpenAI?
Yes. Classification is an easy task for any modern model. Swap the OpenAI model nodes for Anthropic or Google Gemini nodes — the prompts and the rest of the workflow stay the same.
How is this different from Gmail's built-in tabs and Gemini features?
Gmail's tabs sort by sender type using fixed heuristics. This reads the actual content, sorts into categories YOU define, writes reply drafts, answers support questions from your own FAQ data, and notifies your team — none of which Gmail does.