n8n Inbox Triage with LLM Classification

Classify incoming email into categories with structured output, then label, route, or draft replies.

n8nemailclassificationgmail
Setup time1-2 hours (estimate)
Estimated costn8n self-hosted is free (n8n Cloud is paid); one small LLM call per email.
Toolsn8n, Gmail
VerificationNot yet independently verified

Nodes

  1. Gmail Trigger (poll every minute) or Email Trigger (IMAP).
  2. Basic LLM Chain with a Structured Output Parser using the schema below.
  3. Switch on category.
  4. 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

Inspiration

Real-world reports that inspired or relate to this blueprint, credited to Agent Use Cases:

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.

– votes

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