Skip to content
All modules

Module 06 · business · intermediate

Gmail Inbox Triage

After this module you can let AI read every incoming email, categorize it, flag what's urgent, and label it in Gmail automatically.

What it does

Every minute, new unread emails are sent to OpenAI (gpt-5-mini) which returns a category (sales, support, billing, newsletter, personal, other), an urgent flag and a one-line summary. The matching Gmail label is applied, and urgent emails branch to a notification step. The same logic is exposed as POST /webhook/triage so you can test it without Gmail.

Flow

New Email (Gmail) ─────────────────────────┐
Triage API → Has Content? ─true─→ Prepare Email → Classify Email (OpenAI) → Triage Result → Called via API?
                          └false→ 400                                                       ├true→ Respond
                                                     Label Map → Apply Label → Urgent? → Notify Me ←┘false

Verification status

  • API validation (400): tested on n8n 2.43.6. Valid emails reach the OpenAI sub-node and stop at "Node does not have any credentials set", as expected without a key.
  • Classification: needs an OpenAI credential. Run WITH_CREDS=1 ./test/test.sh (no Gmail needed for this).
  • Gmail trigger + labels: needs a Gmail credential and your label IDs in Label Map.

Files

File Tier Purpose
lesson.md Free Step-by-step build
workflow/starter.json Free Webhook + Prepare Email only
workflow/learner.json Learner Finished workflow
workflow/business.json Business Business workflow (see setup guide)
setup-guide.md Business Credentials + configuration
exercises.md Learner Practice tasks
solutions.md Learner Exercise solutions
notes.md Private Learning log
sell/ Private Offer, video script, blog post