Skip to content

Workflow · Operations

Build Support Ticket Triage + Draft Reply

An automation that classifies incoming tickets, routes them, pulls account context, and drafts replies your agents review before sending.

Intermediate3–5 hoursStack: Claude or GPT-5, Zendesk / Intercom / Freshdesk API, n8n or Node.js / Python, Your product database (read-only)
SupportTriageAgentSaaS
Edited by The AIKnowHub team · Editorial team

Problem

Support queues grow faster than headcount. Agents spend the first 5–10 minutes per ticket on classification, account lookup, and writing a generic opener — before they even understand the issue. SLA pressure makes quality slip.

Final output

A webhook-driven pipeline: every new ticket gets a priority label, topic tag, one-paragraph summary, linked account context, and a draft reply saved as an internal note. Agents open tickets that are 80% ready. Nothing sends without human approval.

Architecture

New ticket webhook (Zendesk / Intercom / Freshdesk)
  → Normalize payload (customer, subject, body, channel)
  → Classifier LLM → { priority, topic, sentiment, needs_escalation }
  → Context fetcher → customer plan, recent orders, open tickets, feature flags
  → Draft LLM → reply in support voice + cited internal doc links
  → Write back: tags, priority, internal note with draft
  → Optional: route to queue / assignee by topic
  → Slack alert if priority=critical or needs_escalation=true

Step-by-step

  1. 01

    Webhook + ticket normalization

    Subscribe to ticket.created. Map vendor fields to a canonical shape: ticket_id, customer_email, subject, body, channel, attachments metadata.

  2. 02

    Build the classifier

    Cheap LLM call with structured output: priority (P0–P3), topic (billing/bug/how-to/account/security), sentiment, needs_escalation boolean. Cache by ticket hash for retries.

  3. 03

    Fetch account context

    Read-only queries: customer record, subscription, last 3 tickets, recent errors from your app DB or CRM. Cap context at ~4K tokens.

  4. 04

    Draft the reply

    Stronger LLM with support voice examples + retrieved help-doc snippets. Output: draft reply, confidence, doc links used, [BRACKET] placeholders for unknowns.

  5. 05

    Write back to the helpdesk

    Apply tags and priority. Post draft as internal note — never public reply on v1. Optionally assign queue by topic.

  6. 06

    Escalation alerts

    P0 or security topics → Slack ping with ticket link, summary, and draft. On-call sees it in under 60 seconds.

What you'll build

A pipeline that turns raw support tickets into classified, contextualized, draft-ready work items — so agents spend time fixing problems, not parsing inboxes.

Similar in spirit to the AI Email Assistant, but wired to your helpdesk and product data.

The flow

New ticket
  → Classify (priority, topic, sentiment)
  → Fetch customer context
  → Retrieve relevant help docs (RAG)
  → Draft reply (internal note)
  → Tag, route, alert if critical

Humans always send. The automation prepares.

Step 1 — Webhook intake

Every major helpdesk fires ticket.created. Normalize to one shape so the rest of the pipeline is vendor-agnostic:

{
  "ticket_id": "98421",
  "customer_email": "alex@acme.com",
  "subject": "Can't export CSV since yesterday",
  "body": "...",
  "channel": "email"
}

Run this in n8n for speed, or a small Express / FastAPI service if you prefer code.

Step 2 — Classify first, always

Classification is cheap and high-leverage. A Haiku-class model handles priority + topic with >90% accuracy when you give clear definitions.

Feed agent corrections back weekly — "this was P1 not P3" — and tune the priority guide in the prompt.

Step 3 — Account context

Before drafting, pull read-only context:

  • Plan tier and renewal date
  • Last 3 tickets (subjects + resolution)
  • Recent product events (failed payment, feature flag, error spike)

Cap at ~4K tokens. The draft model doesn't need their full order history — it needs why this ticket might be happening.

If you already built an MCP server from your API, expose get_customer_context as a tool your triage agent calls.

Step 4 — RAG over help docs

Don't stuff your entire help center into the prompt. Embed articles, retrieve top 3 by topic:

  1. Ticket classified as how-to + export.
  2. Retrieve "Exporting data", "CSV limits", "Troubleshooting export errors".
  3. Pass snippets to the drafter with titles and URLs.

See RAG Explained if you're new to retrieval.

Step 5 — Draft as internal note

Post the draft where agents already work — Zendesk internal note, Intercom note, Freshdesk private comment.

Include:

  • Draft reply — ready to copy-edit and send.
  • Summary — one line for queue scanners.
  • Flags[NEEDS BILLING] / [SECURITY] / [CONFIRM REFUND].
  • Doc links — what the model actually used.

Track accept rate: sent as-is, sent with minor edits, rejected entirely.

Step 6 — Routing and alerts

Simple routing table:

TopicQueue
billingBilling Team
securitySecurity + on-call
bugTier 2 Engineering
how-toGeneral Support

P0 or security → Slack webhook with ticket link. On-call shouldn't dig through a queue.

Tuning for quality

The difference between agents loving this and ignoring it:

  • Voice corpus — 20–30 exemplary replies per topic. Refresh monthly.
  • Placeholder discipline[ORDER ID] beats guessing.
  • Conservative priority — false P0s burn trust faster than slow P2s.
  • Feedback loop — rejected drafts feed a weekly prompt review.

Cost reality

At ~$0.08/ticket all-in, 5,000 tickets/month costs ~$400 in LLM spend. Compare to one additional L1 hire. Most SaaS teams at 2k+ tickets/month see positive ROI within the first month if accept rate clears 40%.

Extensions

  • Suggested macros — map topic → macro template the agent can apply.
  • Auto-suggest assignee — based on historical resolution by agent + topic.
  • CSAT predictor — flag tickets likely to churn before they escalate.
  • Sidebar in helpdesk — iframe showing context + draft without leaving the ticket view.

Ship read-only triage + drafts first. Auto-send is a v3 conversation, not a v1 feature.

Prompt examples

Copy any of these, replace the placeholders, run.

Ticket classifier

You are a support triage system for {{product_name}}.

Classify this ticket:

Output JSON:
{
  "priority": "P0" | "P1" | "P2" | "P3",
  "topic": "billing" | "bug" | "how-to" | "account" | "security" | "feature-request" | "other",
  "sentiment": "angry" | "frustrated" | "neutral" | "positive",
  "needs_escalation": boolean,
  "summary": "one sentence, under 120 chars",
  "reasoning": "one sentence for the agent"
}

Priority guide:
- P0: outage, data loss, security breach, payment blocked for enterprise
- P1: broken core feature, billing error with charge
- P2: non-blocking bug, how-to with workaround missing
- P3: general question, feature request, praise

Customer: {{customer_email}}
Subject: {{subject}}
Body: {{body}}

Draft support reply

Draft a support reply for a human agent to review and send.

Voice examples (match tone and length):
{{support_voice_samples}}

Customer context:
{{account_context}}

Relevant help docs:
{{doc_snippets}}

Rules:
- 3–8 sentences. Empathetic, direct, no fluff.
- Cite doc titles when pointing to self-serve steps.
- Use [BRACKET] for info you don't have (order ID, screenshot request).
- Never promise refunds, timelines, or policy exceptions without [CONFIRM WITH LEAD].
- If security-related, do not ask for passwords or full card numbers.

Ticket:
{{ticket_body}}

Output JSON:
{ "draft": string, "doc_links": string[], "confidence": 0-1, "flags": string[] }

Cost estimate

Line itemApprox. cost
Classifier (Haiku / Mini, per ticket)$0.002
Context + draft (Sonnet, per ticket)$0.08
Per 1,000 tickets triaged$80.00
n8n self-hosted$0.00
Zendesk / Intercom (existing plan)unchanged
Total per run (approx.)~$80.08

Costs depend on model choice, content length, and how aggressively you cache.

Optimizations

  • Classify with the cheapest model — 4-bucket priority is high-accuracy even on mini models.
  • RAG over help-center articles instead of stuffing full docs — retrieve top 3 by topic.
  • Skip drafting on spam/auto-reply tickets the classifier tags as P3/other with low confidence.
  • Prompt-cache support voice examples and product overview across all drafts.
  • Batch context fetches when multiple tickets share a customer domain.

Common mistakes

  • Auto-sending replies — one bad draft erodes trust. Internal notes until accept rate is high.
  • No account context — drafts sound generic and agents rewrite everything anyway.
  • Over-tagging P0 — cry-wolf kills on-call. Tune with weekly agent feedback.
  • Ignoring attachments — mention "we'll review the screenshot" even if you can't parse images yet.
  • Skipping audit logs — you need accept/reject metrics to improve prompts.

Frequently asked questions

All expose webhooks and APIs for tags, notes, and priority. Intercom is chat-heavy; Zendesk is ticket-heavy. The pipeline is identical — swap the adapter layer.