DEV Community

HaoPeng Zhang
HaoPeng Zhang

Posted on

I automated my inbox triage with n8n + GPT-4o-mini (copy the exact workflow)

Inbox zero is a lie. Triage is the real skill.

You don't need an empty inbox. You need to know which 12 of your 200 unread emails actually need you today — and which ones can die quietly.

I got tired of scanning my inbox every morning, so I built a small n8n + GPT-4o-mini workflow that reads new mail, sorts every message into one of four buckets, and drafts a reply for the ones that need one. It runs on a schedule, costs pennies, and takes about 15 minutes to set up.

Here's the whole thing — plus the one design decision that made it actually usable.

The idea: force a fixed taxonomy

The first version I built asked the model "is this email important?" It was useless. Every email came back "somewhat important."

The fix was to stop asking for a judgement and start asking for a single label from a fixed taxonomy. Four buckets, no hedge, no score:

  1. Reply today — a real human is waiting on a decision or an answer.
  2. Task, not today — actionable, but it belongs in a to-do list, not your face right now.
  3. Read later — newsletters, FYIs, things worth a skim.
  4. Noise — promos, cold outreach, notifications you'll never open.

One label per email. That's it.

The prompt (this is the whole trick)

You are an inbox triage assistant. Read the email below and return exactly one of these labels on the first line: REPLY_TODAY, TASK_LATER, READ_LATER, NOISE.

Rules:

  • Only use REPLY_TODAY if a specific person is blocked on your answer.
  • Marketing, cold sales, and automated notifications are always NOISE.
  • If you choose REPLY_TODAY or TASK_LATER, write a one-sentence draft reply (max 40 words) on the second line, in the sender's language, in a friendly professional tone.

Subject: {{ $json.subject }}
From: {{ $json.from }}

Body:
{{ $json.snippet }}

Two things matter here: the label set is closed, and the draft is only generated for the two buckets that need one. That keeps token usage (and cost) low.

The 4 nodes

  1. Schedule Trigger — every weekday at 08:00.
  2. Gmail → Get Many Messages — filter in:inbox is:unread newer_than:1d.
  3. OpenAI (GPT-4o-mini) — the prompt above, text mode, temperature 0.
  4. Router → Gmail / Sheets — REPLY_TODAY gets starred + draft attached; TASK_LATER gets appended to a Google Sheet; the rest get labeled and archived.

That's a real workflow, not a toy. The router is just a Switch node on the first line of the model's output.

3 rules that made it usable

  • Temperature 0. Classification should be boring and repeatable, not creative.
  • Send the snippet, not the full body. The model doesn't need a 40-line signature block to know an email is a newsletter — and it halves your token bill.
  • Never auto-send. The workflow drafts. You still tap send. That single decision is the difference between a helpful assistant and a horror story.

Want it without rebuilding it?

Rebuilding this from scratch (Gmail OAuth, the filter, the parser, the router) is the boring part. I packaged the polished version as a ready-to-import n8n template:

Triage your inbox once, and you'll never go back to scanning.

Top comments (0)