# Support Ticket Triage with AI

> Analyze incoming Zendesk or Intercom tickets with AI, tag them by sentiment, and escalate urgent cases in Slack.

**Building on the basics · about 20 minutes · 6 steps**

Read every incoming support ticket with AI, decide its sentiment and urgency, and route the angry-and-critical ones straight to a person. The worked steps use Zendesk; you can apply the same pattern to an Intercom new-ticket trigger and its ticket actions.

This is the first recipe with AI in it, and the first that routes on an AI's answer rather than a true/false check.

Zendesk trigger → [AI Prompt](/build/ai-features/ai-prompt) → [Switch](/build/action-steps/switch) → Zendesk and Slack

## What you will use

- An **AI Prompt** step, told to return JSON so the next step can route on it.
- A **Switch** step, for routing to one of several branches rather than only true or false.

## Prerequisites

- A connected **Zendesk** account with permission to read and update tickets, plus an Escalation Team ready to receive critical tickets. To adapt the recipe, connect Intercom and select its corresponding ticket trigger and actions instead.
- A connected **Slack** workspace with the person or channel that should receive escalation alerts. Your company may require an administrator to approve the connection.

The AI Prompt step needs nothing connected. It runs on Glow's managed models, with no provider account or API key to set up.

---

## Building the Workflow

### 1. The Trigger: Zendesk (New Ticket)
Drag a **Zendesk** trigger onto the canvas. Select the "New Ticket Created" event. This ensures Glow wakes up the second a customer sends an email or submits a form.

### 2. The AI: AI Prompt Step

A classification this narrow does not need a full agent. Add an **AI Prompt** step.

In the **Instructions** field, tell the model what to decide and in what shape:

> _"Analyze the following support ticket. Determine the sentiment (Positive, Neutral, Angry) and the urgency (Low, High, Critical). Return the result as a strict JSON object."_

Reference the sanitized ticket body inside those instructions: `{{ 1.ticket.description | strip_html | trim }}`. Using [Data Transformation](/build/core-concepts/data-transformation) removes raw HTML tags from incoming emails before feeding them to the AI, saving token budget and improving classification accuracy.

Switch on **Parse JSON result** in the same step. It is off by default, and without it the answer comes back as a block of JSON _text_ rather than fields you can read. With it on, `{{ 2.result.sentiment }}` and `{{ 2.result.urgency }}` work as written below. Skip it and every ticket takes the Fallback path, because the Switch is reading text rather than the fields it expects.

### 3. The Logic: Switch Step (Escalation)

Add a **Switch** step to route the ticket based on the AI's analysis.

- **Case 1 (Angry):** `{{ 2.result.sentiment }}` equals `Angry` AND `{{ 2.result.urgency }}` equals `Critical`.
- **Fallback:** everything else. This is the step's own fallback output, not a case you write.

Switch compares case-sensitively by default, so `Angry` and `angry` are different values. That is why the instructions above name the exact words the model must return.

### 4. The Actions: Tagging & Alerts

On the **Fallback** path, add a **Zendesk** action to update the ticket. Put `{{ 2.result.sentiment }}` and `{{ 2.result.urgency }}` in the tags field, so every ticket carries what the AI decided.

On the **Angry** path, add two steps:

1. **Zendesk:** Update the ticket priority to `Urgent` and assign it to the Escalation Team.
2. **Slack:** Send an alert to the person or channel you prepared, including the ticket link.

## Test and go live

### Test the escalation route

Create a ticket with an unmistakably urgent message, such as `Production login is down for every user and we need help now`. Run it and inspect the AI Prompt result. It should contain the exact `Angry` and `Critical` values the Switch expects before the escalation branch runs.

### Test the fallback route

Create a neutral request, such as `Please send me a copy of last month's invoice`. Confirm it takes **Fallback**, receives the classification tags and does not post the urgent Slack alert.

### Check the destinations

Open both Zendesk and Slack. Confirm the critical ticket is urgent, assigned to the expected team and represented by one Slack alert. If the Switch cannot read `sentiment` or `urgency`, check that **Parse JSON result** is on and read the AI step's stored output before changing the cases.

### Set the workflow Live

Switch the workflow to **Live**, submit one controlled ticket from your test requester and confirm its live execution reaches the expected destination exactly once.

## What's Next?

👉 **[Continue to B2B Lead Enrichment →](/getting-started/cookbook/lead-enrichment-apollo)**

- Tune the classification call itself in the [AI Prompt Step](/build/ai-features/ai-prompt).
- Clean and prepare incoming text payloads with [Data Transformation](/build/core-concepts/data-transformation).
- Add more triage lanes than angry and default with the [Switch Step](/build/action-steps/switch).
