> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hiveku.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow Recipe: Auto-Route Support Tickets

> Assign incoming support requests to the right team member based on content

Manual ticket triage is expensive — someone reads every incoming request, decides who handles it, and forwards it. That person becomes a bottleneck, and response times suffer. This recipe uses AI classification to route tickets automatically the moment they arrive.

<Info>
  Before you start: you'll need a support inbox connected (a form submission endpoint or an inbound email handler) and a team with defined roles.
</Info>

## The Flow at a Glance

<CardGroup cols={3}>
  <Card title="Classify" icon="tags">
    AI reads the ticket and picks a category
  </Card>

  <Card title="Route" icon="arrow-right-arrow-left">
    Assign to the right person or channel
  </Card>

  <Card title="Acknowledge" icon="envelope-open">
    Confirm receipt with the customer
  </Card>
</CardGroup>

## Step 1: Create the Workflow

<Steps>
  <Step title="Open Workflows">
    In your project, go to **Workflows > New Workflow**. Name it `Support Ticket Routing`.
  </Step>

  <Step title="Add a Webhook trigger">
    Click **Add Trigger > Webhook**. Wire this URL to your support form submission handler or inbound email parser. The trigger payload should include at minimum `email`, `subject`, and `body`.
  </Step>
</Steps>

## Step 2: AI Classification

Add an **AI Prompt** action:

```
Classify this support ticket into one category: 
billing, technical, sales, or general.

Ticket: "{{trigger.subject}} — {{trigger.body}}"

Return just the category name, lowercase.
```

Store the result in a variable named `category`.

<Tip>
  Keep the prompt short and constrained. "Return just the category name, lowercase" is load-bearing — without it, the model often returns full sentences that break downstream conditions.
</Tip>

## Step 3: Route by Category

Add a **Condition** block with branches for each category:

<Steps>
  <Step title="Billing branch">
    * Assign ticket to `billing@yourco.com`
    * Send Slack message to `#billing-support`
    * Set priority based on amount mentioned
  </Step>

  <Step title="Technical branch">
    * Assign to tech lead
    * Slack to `#dev-support`
    * Include any error messages or stack traces from the body
  </Step>

  <Step title="Sales branch">
    * Assign to the next sales rep in rotation
    * Slack to `#sales`
    * Tag with company size / deal potential if detected
  </Step>

  <Step title="General branch">
    * Round-robin among the support team
    * Slack to `#general-support`
  </Step>
</Steps>

## Step 4: Create a CRM Task or Ticket

Use an **HTTP Request** action to create the ticket in your support tool — Linear, Zendesk, HelpScout, Intercom, or just an internal `tickets` table.

Include:

* Customer email and name
* Category (from AI step)
* Priority (if detected)
* Original subject and body
* Ticket ID that customer can reference

## Step 5: Acknowledge the Customer

Send an auto-reply so the customer knows their ticket was received. Customize per category:

* **Billing:** "We've received your billing question. A specialist will respond within 4 business hours."
* **Technical:** "Your technical request (`#{{ticket.id}}`) is assigned to our engineering team. Expected response: 24 hours."
* **Sales:** "A sales rep will reach out within the day. Meanwhile, here's a case study that might help."
* **General:** "Thanks for reaching out. We'll get back to you within 1 business day."

<Warning>
  Never auto-reply without a human-sounding tone. Generic "Your request has been received" emails erode trust. Match the category's voice.
</Warning>

## Priority Detection

Extend the AI step to also return urgency:

```
Classify this ticket into:
1. Category: billing | technical | sales | general
2. Priority: urgent | normal | low

Urgent = site down, data loss, security issue, or strong unhappy language.
Normal = standard questions and requests.
Low = feature suggestions, general info.

Ticket: "{{trigger.subject}} — {{trigger.body}}"

Respond as JSON: {"category": "...", "priority": "..."}
```

Urgent tickets get paged to on-call via SMS ([Twilio](/how-tos/connect-twilio)). Normal goes to standard channels. Low gets filed for weekly review.

## Language Detection

For international teams, detect language and route accordingly:

```
What language is this ticket in? Respond with the ISO 639-1 code 
(e.g., "en", "es", "fr", "de"). If unclear, respond "en".

Ticket: "{{trigger.body}}"
```

Route non-English tickets to the matching language queue, or use the language to pick which translation template to use for the acknowledgement.

## Auto-Resolve Simple Tickets

Some tickets don't need a human. Common examples:

* Password reset requests → reply with self-serve link
* "How do I change my email?" → link to settings page
* Refund status inquiries → query your DB and respond with the refund state

Add a condition after classification: if category is `general` AND body matches known patterns, send the canned response and close the ticket without assigning.

<Tip>
  Start with one auto-resolve pattern, watch it for a week, then add more. Premature auto-resolution gives customers the wrong answer and turns them into angry humans asking again.
</Tip>

## SLA Tracking

Based on category and priority, set SLAs and monitor them:

| Category + Priority | SLA (first response) |
| ------------------- | -------------------- |
| Urgent              | 15 minutes           |
| Billing (normal)    | 4 hours              |
| Technical (normal)  | 24 hours             |
| Sales (normal)      | 1 business day       |
| Low priority        | 3 business days      |

Add a scheduled workflow that runs every hour, checks for tickets older than their SLA without a response, and pings the assignee or their manager.

<Tip>
  Monitor AI classification accuracy weekly. If wrong categories creep in, improve the prompt with examples from misrouted tickets — few-shot prompting dramatically improves consistency.
</Tip>

## Verify It Worked

<Steps>
  <Step title="Submit a test ticket">
    Use your support form or send an email to the support inbox with content like: "My credit card was charged twice this month, can you help?"
  </Step>

  <Step title="Confirm classification">
    Check the workflow run log. AI should classify it as `billing`.
  </Step>

  <Step title="Confirm routing">
    See the Slack message in `#billing-support`. Confirm the billing team member is assigned.
  </Step>

  <Step title="Confirm acknowledgement">
    Check the customer's inbox for the auto-reply. Confirm the tone matches billing context.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="AI is misclassifying tickets">
    Improve the prompt with few-shot examples from tickets that got routed wrong:

    ```
    Examples:
    - "card was charged twice" → billing
    - "login button doesn't work" → technical
    - "pricing for 50 users?" → sales
    ```

    Pull 5-10 real misrouted tickets each week and add them to the prompt.
  </Accordion>

  <Accordion title="Too many tickets landing in 'general'">
    The category list is too narrow. Add subcategories — "billing\_refund", "billing\_invoice", "technical\_auth", "technical\_performance" — so AI has more precise buckets. More categories means less "general" fallback.
  </Accordion>

  <Accordion title="Auto-reply sounds robotic">
    Customize messaging per category instead of using one generic template. Write each reply in a voice that matches the context — billing is calm and precise, sales is warm and quick, technical is competent and specific.
  </Accordion>

  <Accordion title="Round-robin assigning to people on vacation">
    Integrate with your time-off calendar. Before assigning, filter the on-rotation list by `is_out_of_office = false`. Or use availability-aware round-robin that respects explicit OOO status in Slack or your HR system.
  </Accordion>

  <Accordion title="Urgent tickets not being paged">
    Check the priority detection — the JSON parsing step may be dropping malformed AI output. Add a validator that defaults to `normal` if the AI returns unexpected content, and log unparsed output so you can tune the prompt.
  </Accordion>
</AccordionGroup>

## What's Next?

<CardGroup cols={2}>
  <Card title="Webhook Patterns" icon="webhook" href="/how-tos/webhook-patterns">
    Handle inbound form and email webhooks reliably
  </Card>

  <Card title="Connect Slack" icon="slack" href="/how-tos/connect-slack">
    Pipe alerts and ticket notifications into Slack
  </Card>
</CardGroup>
