AutomationIntermediate

How to Auto-Classify and Route Support Tickets with AI in n8n

Use an LLM to tag incoming tickets by category and urgency, then branch the workflow to route each one to the right team automatically.

9 minIntermediate

Manual ticket triage is slow and inconsistent. With an LLM and a Switch node you can read each incoming request, classify it into a fixed set of categories, and route it to the right place. The trick is forcing structured output so the rest of the workflow can branch reliably.

What you need

  • A running n8n instance with an OpenAI credential
  • A ticket source such as a webhook, form, or shared inbox
  • Destinations for each route (different Slack channels, labels, or assignees)

Step 1: Capture the ticket

Add a trigger for wherever tickets arrive. A Webhook node is the most flexible: point your form or help desk at its URL and the ticket text lands in the workflow as JSON.

Step 2: Classify with structured output

Add an OpenAI node and instruct it to return strict JSON. Asking for JSON rather than free text means the next nodes can read fields directly instead of parsing prose.

OpenAI node - User message
Classify this support ticket. Respond with JSON only:
{ "category": "billing|technical|sales|other",
  "urgency": "low|medium|high" }

Ticket:
{{ $json.body.message }}
Turn on JSON output
Enable the JSON output option on the OpenAI node (or use a Structured Output Parser). It guarantees valid JSON so a stray sentence from the model cannot break your branching logic.

Step 3: Branch with a Switch node

Add a Switch node with one output per category. Set each rule to compare {{ $json.category }} against billing, technical, sales, and a fallback output for other. Each branch then leads to its own destination node.

n8n - Switch routing
Switch on {{ $json.category }}
billing -> Slack #billing
technical -> Create Jira issue
sales -> Slack #sales
other -> Slack #triage (fallback)
One output branch per category, each going to a different team.

Step 4: Add urgency handling

Inside the technical and billing branches, add an IF node that checks whether urgency equals high. On the true path, send an extra alert or mention an on-call person so the most pressing tickets are never buried.

Result

Each ticket is now read, tagged, and routed within seconds of arriving. High urgency technical and billing issues get an additional ping, and anything the model cannot confidently place falls through to a triage channel for a human to sort.

Watch related tutorials

Tags
#n8n#classification#routing#support