# Sentiment-Driven Routing
URL: /recipes/sentiment-driven-routing
Type: howto
Description: Analyze ticket sentiment, classify intent with AI, then route to specialized handling: human review for refunds, Linear issues for bugs, and auto-tagging for everything else.
Keywords: sentiment-driven routing, sentiment-driven-routing, recipe, workflow template, workflow builder, zendesk, linear
Analyze ticket sentiment, classify intent with AI, then route to specialized handling: human review for refunds, Linear issues for bugs, and auto-tagging for everything else.

<Callout type="info">
  **Prerequisites:** Connect **Zendesk**, **Linear** before adding this recipe. See [Integrations](/integrations).
</Callout>

How it works [#how-it-works]

Each box is a block; arrows show the order Stylo runs them, and branch labels show the path taken on each outcome.

<Mermaid
  chart="flowchart TD
  trigger[&#x22;New Ticket&#x22;]
  get_context[&#x22;Get Ticket Context&#x22;]
  classify_sentiment[&#x22;Classify Sentiment&#x22;]
  tag_sentiment[&#x22;Tag Sentiment&#x22;]
  route_intent[&#x22;Route by Intent&#x22;]
  refund_review[&#x22;Refund Review&#x22;]
  refund_approved_tag[&#x22;Tag Refund Approved&#x22;]
  refund_approved_note[&#x22;Approved Note&#x22;]
  refund_rejected_tag[&#x22;Tag Refund Rejected&#x22;]
  refund_rejected_note[&#x22;Rejected Note&#x22;]
  create_linear_issue[&#x22;Create Linear Issue&#x22;]
  bug_tag[&#x22;Tag Bug Report&#x22;]
  bug_note[&#x22;Bug Tracking Note&#x22;]
  feature_tag[&#x22;Tag Feature Request&#x22;]
  feature_note[&#x22;Feature Request Note&#x22;]
  general_tag[&#x22;Tag General&#x22;]
  trigger --> get_context
  get_context --> classify_sentiment
  classify_sentiment --> tag_sentiment
  tag_sentiment --> route_intent
  route_intent -->|&#x22;refund&#x22;| refund_review
  refund_review -->|&#x22;approved&#x22;| refund_approved_tag
  refund_approved_tag --> refund_approved_note
  refund_review -->|&#x22;rejected&#x22;| refund_rejected_tag
  refund_rejected_tag --> refund_rejected_note
  route_intent -->|&#x22;bug&#x22;| create_linear_issue
  create_linear_issue --> bug_tag
  bug_tag --> bug_note
  route_intent -->|&#x22;feature&#x22;| feature_tag
  feature_tag --> feature_note
  route_intent -->|&#x22;general&#x22;| general_tag"
/>

Parameters [#parameters]

Set these when you add the recipe to your workspace:

| Parameter                 | Type   | Default             |
| ------------------------- | ------ | ------------------- |
| `linear_team_id`          | string | —                   |
| `refund_approval_channel` | string | `#refund-approvals` |

Blocks used [#blocks-used]

Every block in this recipe, linked to its reference page where one exists:

| Block                                        | Type                         | What it does                                                                                                       |
| -------------------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [Webhook](/reference/blocks/trigger-webhook) | `trigger/webhook`            | Trigger workflow via HTTP webhook                                                                                  |
| Get Ticket Context                           | `zendesk/get-ticket-context` | Get complete ticket context (ticket, conversation, attachments, customer, assignee, organization) optimized for AI |
| [Classify](/reference/blocks/ai-classify)    | `ai/classify`                | Classify content into predefined categories using AI                                                               |
| Add Tags                                     | `zendesk/add-tags`           | Add tags to a ticket for classification and tracking                                                               |
| [Router](/reference/blocks/system-router)    | `system/router`              | Branch into N paths via boolean predicates or AI classification.                                                   |
| Human Review                                 | `system/human-review`        | Pause and wait for human approval before continuing                                                                |
| Add Comment / Reply                          | `zendesk/add-comment`        | Add a public reply or internal note to a ticket                                                                    |
| Create Ticket                                | `linear/create-ticket`       | Create an issue in Linear                                                                                          |

When to use it [#when-to-use-it]

Use this when different emotional tones and intents deserve different handling — for example, routing refund requests to a human for approval, filing bug reports as Linear issues, and auto-tagging everything else.

Adapt it [#adapt-it]

This recipe is a starting point. To fit it to your workspace:

* Set the `linear_team_id` parameter so bug reports file into the right Linear team.
* Set the `refund_approval_channel` parameter to the Slack channel where refund approvals are requested.
* Edit the sentiment categories and the **Route** definitions to match the intents your team handles.

Related [#related]

* [All recipes](/recipes)
* [Workflow blocks reference](/reference/blocks)
* [Workflow Builder overview](/workflow-builder-overview)
* [Integrations](/integrations)