Templates / AI Email Triage: Auto-Label Gmail + Urgent Alerts

AI Email Triage: Auto-Label Gmail + Urgent Alerts

Intermediate   Apps: Gmail, OpenAI, Slack  ·  Setup: 15 minutes

Gmail filters sort by sender and keyword; they can't tell an angry customer from a newsletter that happens to say 'urgent'. This workflow has GPT-5.6 read each incoming email and classify it by what it actually is - Urgent, Customer, Invoice, or Newsletter - applies the matching Gmail label, and pings Slack only for the urgent ones. Your inbox becomes a sorted queue instead of a slot machine.

Download workflow JSON (free) Setup guide

What this workflow does

  1. A Gmail Trigger polls for new inbox messages every few minutes.
  2. An OpenAI node classifies the email into one of four categories, replying with a single word.
  3. A Code node maps the category to your Gmail label ID.
  4. A Gmail node applies the label.
  5. An IF node routes Urgent emails to a Slack alert with sender and subject.

Setup guide

  1. Import the JSON into n8n (Workflows > Import from File).
  2. Connect Gmail (OAuth) in the trigger and the label node.
  3. In Gmail, create labels: AI/Urgent, AI/Customer, AI/Invoice, AI/Newsletter. Get their IDs from the n8n Gmail node's label dropdown and paste them into the Code node mapping.
  4. Add your OpenAI API key, and adjust the four category definitions in the prompt to your business.
  5. Connect Slack for urgent alerts. Activate and send yourself test emails.

Want this running 24/7?

Self-host n8n on a cheap VPS and this workflow runs around the clock for less than a coffee a month.

Get an n8n VPS from $5/month

FAQ

Is my email content sent to OpenAI?The subject and the first 2000 characters of the body are sent for classification. If that's a concern, run the same prompt against a local model via Ollama - swap the OpenAI node for a local LLM node; the rest is unchanged.
Can I add my own categories?Yes - edit the category list in the prompt and add the label mapping in the Code node. Keep categories mutually exclusive and under about seven for reliable one-word answers.
What does this cost to run?With gpt-5.6-luna, classifying 100 emails a day costs a few cents a month - less than any email triage SaaS by orders of magnitude.

Want the workflows this one is a warm-up for?

The Mega Bundle packs both WorkflowForge Pro volumes — 32 production-grade workflows: automations (cart recovery, lead scoring, invoice extraction) and AI agents (support agent, calendar assistant, research agent), each with a setup guide. $39 for both, instant download.

Get the Mega Bundle →

Need it customized for your exact process?

I build custom n8n automations and AI agents professionally: your tools, your edge cases, tested and documented.

Hire me on Fiverr →