# AI ticket triage and routing n8n template

> An importable n8n workflow that receives each new Zendesk ticket by webhook, asks Claude for a category, product area, language, sentiment and priority as strict JSON, validates every value in code, then tags the ticket and posts urgent ones to Slack. You need n8n, a Zendesk admin login, an Anthropic API key, Google Sheets and Slack.

- Platform: n8n
- Download: https://www.lumeor.studio/templates/n8n/ai-ticket-triage-and-routing.json
- Trigger: Zendesk webhook on ticket created
- Credentials needed: Zendesk API, Anthropic API, Google Sheets OAuth2, Slack
- Full guide: https://www.lumeor.studio/guides/ai-ticket-triage-and-routing/
- Last updated: 2026-10-14

## What this workflow does

1. **Zendesk ticket created** (Webhook) receives the ticket ID, subject, first message, requester, organization, plan tier and tags from a Zendesk trigger.
2. **Prepare classification** (Code) skips tickets already tagged `ai_triaged`, so the workflow's own update cannot loop, and builds the prompt from your taxonomy.
3. **Classify with Claude** (HTTP Request) calls the Anthropic Messages API with a strict JSON schema. Every enum in the schema comes from the taxonomy, so the model can only answer with values you defined.
4. **Validate and set priority** (Code) handles refusals, truncated answers and API errors, rejects any value not on the allowed list, and bumps priority one level for top-tier accounts.
5. **Classification OK?** (If) sends failures to the exceptions channel.
6. **Log triage result** (Google Sheets) writes one row per ticket so you can measure agreement with your agents.
7. **Update Zendesk ticket** adds tags (`ai_triaged`, `ai_cat_*`, `ai_area_*`), fills custom fields and, once you allow it, sets priority.
8. **Escalate?** and **Alert urgent ticket** post urgent tickets, or negative tickets from top-tier accounts, to Slack with a link.

## Before you import

- A current n8n version (cloud or self-hosted) with a public URL for the webhook.
- A Zendesk admin who can create webhooks, triggers and custom fields, plus an API token.
- An Anthropic API key. The template uses `claude-opus-5-5`; `claude-haiku-5-5` is cheaper for high volume.
- A Google Sheet with a tab named `Triage log` and a Slack bot that is a member of both channels.

## Setup

1. Import the JSON and create the four credentials. Select them on the Zendesk, HTTP Request, Google Sheets and Slack nodes.
2. Activate the workflow and copy the production URL from **Zendesk ticket created**.
3. In Zendesk, create a webhook to that URL (POST, JSON), then a trigger on ticket created with the condition "Tags contains none of `ai_triaged`". Paste the JSON body from the sticky note.
4. Edit `CATEGORIES` and `PRODUCT_AREAS` in **Prepare classification** and the matching `ALLOWED` lists in **Validate and set priority**.
5. Replace `REPLACE_WITH_CATEGORY_FIELD_ID` and the other `FIELD_IDS` with your numeric Zendesk field IDs, or leave them and use tags only.
6. Replace `REPLACE_WITH_SHEET_ID`, `REPLACE_WITH_SLACK_CHANNEL_ID`, `REPLACE_WITH_SLACK_EXCEPTIONS_CHANNEL_ID` and `REPLACE_WITH_ZENDESK_SUBDOMAIN`.
7. Add this header row to the `Triage log` tab: received_at, ticket_id, subject, category, product_area, language, sentiment, suggested_priority, final_priority, confidence, low_confidence, escalate, reason.

## Test it

Create three test tickets: a billing question, a "site is down" message and a vague one-liner. Check the execution log, the tags on each ticket and the sheet rows. The vague ticket should carry `ai_low_confidence`. The outage should land in Slack. Then put an invalid key in the Anthropic credential and confirm the next ticket reaches the exceptions channel.

## Make it production-ready

- Keep `SUGGEST_ONLY = true` for a week and compare the logged category with what agents chose before letting the AI set priority.
- Set an n8n error workflow so a failed Zendesk update pages someone instead of failing quietly.
- The HTTP Request node retries three times. Zendesk rate limits depend on your plan, so watch for 429 responses during ticket spikes.
- Store the taxonomy in a sheet once support leads want to edit it themselves.
- Treat ticket text as untrusted input. The prompt says so, and the validator ignores any value outside your lists.

Read the full guide at [AI ticket triage and routing](/guides/ai-ticket-triage-and-routing/) for the taxonomy and testing approach, or [talk to Lumeor](/start/) if you want help adapting it to your helpdesk.

---

Source: https://www.lumeor.studio/templates/ai-ticket-triage-and-routing/
Published by Lumeor Studio, Newtown, PA. hello@lumeor.studio. Get a written scope: https://www.lumeor.studio/start/
