n8n Inbox Triage with LLM Classification
Classify incoming email into categories with structured output, then label, route, or draft replies.
Nodes
- Gmail Trigger (poll every minute) or Email Trigger (IMAP).
- Basic LLM Chain with a Structured Output Parser using the schema below.
- Switch on
category. - Branches: add Gmail label, forward to a teammate, create a task, or Gmail → Create Draft for
needs_reply.
Output schema
{
"type": "object",
"properties": {
"category": {"type": "string", "enum": ["needs_reply", "fyi", "invoice", "newsletter", "spam_like"]},
"urgency": {"type": "string", "enum": ["low", "normal", "high"]},
"summary": {"type": "string"}
},
"required": ["category", "urgency", "summary"]
}Prompt
Classify this email. Use only the defined categories.
From: {{ $json.from }}
Subject: {{ $json.subject }}
Body (truncated): {{ $json.text.slice(0, 4000) }}Create drafts rather than sending automatically; review them before they go out.
Failure modes
- Misclassified urgent emails get buried; review low-confidence labels.
- Long threads exceed context; trim quoted history before classifying.
- Email content can carry prompt injection; never let triage take actions on its own.
Inspiration
Real-world reports that inspired or relate to this blueprint, credited to Agent Use Cases:
- Triage and draft replies for three email accounts (agentusecases.ai)
- Draft email replies and LinkedIn posts with n8n workflows (agentusecases.ai)
Markdown version: /blueprints/n8n-email-triage.md
Want a deeper build of this?
Vote for an extended, fully tested version (more tools, a full workflow file). Votes decide what we build next.
Get one fully built blueprint a week
A weekly email: one blueprint with config, cost, setup time and failure modes, plus a vote on what we build next.
Related blueprints
n8n Form Lead Enrichment and CRM Sync
Capture a lead via n8n Form Trigger, research the company website with an LLM, and upsert into a sheet or CRM.
n8n Global Error Alerting Workflow
A dedicated error workflow that alerts you with the failing workflow, node, and execution link whenever any workflow fails.
n8n RSS to AI Summary Digest
Daily schedule pulls RSS feeds, summarizes new items with an LLM, and posts a digest to Slack or email.