AutoFlowLab
← Templates

AI Email Triage Workflow for n8n: Labels and Drafts

n8n workflow that classifies every Gmail message into 5 categories with AI, applies labels, drafts replies in your voice and pings Slack for urgent mail.

June 2, 2026 · n8n template

Free template · n8n

AI Email Triage Workflow for n8n: Labels and Drafts

email-triage-n8n.json

Download JSON

Inbox zero isn’t a discipline problem, it’s a sorting problem. This n8n workflow reads every incoming Gmail message, decides what kind of email it is, and does the right thing for each kind — including writing the reply draft for messages that need one, so answering becomes a 10-second review instead of a 3-minute compose.

What this workflow does

  • Gmail trigger polls unread inbox mail (promotions excluded by the search query)
  • OpenAI node classifies each message into exactly one of 5 categories with strict JSON output:
    • urgent — deadlines, outages, angry clients, the boss
    • needs_reply — expects a personal response, not time-critical
    • fyi — confirmations, reports, CCs
    • newsletter — digests and product updates
    • spam_or_cold — cold outreach and suspicious mail
  • For needs_reply, the same call also writes a short draft reply in your voice
  • Switch node routes by category:
    • Urgent: Slack alert with a one-line summary and a deep link to the thread
    • Needs reply: Gmail draft created inside the original thread, addressed and ready to edit-and-send
    • Everything else: the matching Gmail label is applied so your inbox sorts itself

Nothing is auto-sent and nothing is deleted — the workflow only labels, drafts, and alerts, which makes it safe to run on a real inbox from day one.

Prerequisites

  • n8n instance (cloud or self-hosted)
  • Gmail OAuth2 credentials for the inbox you’re triaging
  • OpenAI API key (gpt-4o-mini is plenty for classification)
  • Slack bot token and an alerts channel
  • Four Gmail labels created up front (Needs Reply, FYI, Newsletter, Cold) — grab their IDs from the Gmail API or n8n’s label dropdown

How to import

  1. Download the JSON from the box at the top of this page.
  2. In n8n: Workflows → Import from File and select it.
  3. Attach your Gmail, OpenAI, and Slack credentials at the placeholders.
  4. In the “Apply Label” node, replace the four YOUR_LABEL_ID_* values with your real label IDs.
  5. Activate, send yourself two test emails (one urgent-sounding, one question), and check both branches fire.

What to customize

  • Category definitions in the system prompt — the “urgent” definition is where personal judgment lives; name your VIP senders and standing deadlines explicitly
  • The reply voice — the default drafts are 2-3 sentences signed “Best”; paste in two or three of your real replies as style examples for a dramatic improvement
  • The Gmail search query — scope to a label or alias if a full inbox feels too invasive at first
  • Polling frequency — every minute is responsive; every 15 minutes saves executions on n8n cloud plans

The deeper version with sender history and VIP rules is in the AI email triage tutorial.

Cost per run

Classification plus an occasional draft averages 700-1,500 tokens per email on gpt-4o-mini. As of mid-2026 that’s a few hundredths of a cent per message — a 100-email day costs a cent or two. The constraint to watch is execution count on hosted n8n plans, not tokens; self-hosting removes even that.

Try it yourself

n8n

An always-on inbox triager runs hundreds of times a day — on n8n self-hosted that costs exactly zero per execution, and your email never transits a third-party automation cloud.

Start with n8n