# Support Ticket Triage: AI Routing, Priority & Escalation (`ferrolark/ticket-triage`) Actor

Support ticket triage API: route helpdesk tickets to your teams and set P1-P4 priority with calibrated probabilities for urgency, frustration, churn risk, spam and language. Built-in classification, no external API key needed.

- **URL**: https://apify.com/ferrolark/ticket-triage.md
- **Developed by:** [Ferrolark](https://apify.com/ferrolark) (community)
- **Categories:** AI, Automation, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 1,000 ticket triageds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Support Ticket Triage: AI Routing, Priority & Escalation

Route helpdesk tickets to the right team and give each one a **P1-P4 priority** from calibrated signals: urgency, frustration, churn risk, refund request, repeat contact, request for a human, spam and language. Low-confidence tickets go to `manual-review` instead of the wrong queue.

- **Your teams:** pass your own departments with a one-line description each (2-100), or use the defaults (billing, technical, account, orders_shipping, sales, feedback).
- **Priority you can explain:** points from urgency (+3), anger (+2), churn risk (+2), repeat contact, human request and VIP tier, listed in `reasons`.
- **Safe routing:** a ticket goes to a team only if it fits one and routing confidence is above your minimum. `handoffToHuman` marks P1, manual-review and "let me talk to a person".
- **Custom flags:** add yes/no questions such as "Is this a GDPR deletion request?".
- **Any language:** detects the ticket language; works with mixed-language queues.

Classification runs on Ferrolark's built-in calibrated engine. **You do not need an external API key.** Up to 200 tickets per run (8,000 characters each).

### Example

```json
{
  "tickets": [
    {"id": "T-1001", "subject": "Charged twice", "body": "I was billed twice this month. This is the third time I write, fix it or I cancel.", "customerTier": "pro"},
    {"id": "T-1002", "body": "Hola, ¿podéis añadir modo oscuro a la app?"}
  ]
}
```

Output row:

```json
{"id": "T-1001", "route": "billing", "priority": "P1", "reasons": ["angry", "churn_risk", "repeat_contact"], "handoffToHuman": true,
 "departmentConfidence": 0.91, "frustrationLevel": "Clearly frustrated", "language": "en", "tags": ["churn_risk", "refund_request", "repeat_contact"]}
```

### Price

- **$0.0015 per ticket triaged** (1,000 tickets = $1.50).
- Not charged: empty tickets or engine errors before a successful triage.
- Classification cost is included in the event price.

### Input

| Field | Default | What it does |
|---|---|---|
| `tickets` | none | Strings or `{"id", "subject", "body", "customerTier"}`; up to 200. |
| `departments` | 6 defaults | `{"team_id": "what it handles"}`. |
| `customFlags` | none | Extra yes/no questions. |
| `flagThreshold` | 0.7 | Probability to raise a flag. |
| `minDepartmentConfidence` | 0.5 | Below it: `manual-review`. |
| `model` | `jev-latest` | Pin a version for stable behaviour. |

### Call it from code or n8n

```bash
curl -X POST "https://api.apify.com/v2/acts/ferrolark~ticket-triage/run-sync-get-dataset-items?maxTotalChargeUsd=0.05" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"tickets": ["My invoice is wrong and nobody answers"]}'
```

Use it from a Zendesk, Freshdesk, Help Scout or Gmail trigger in n8n/Make and switch on `route` and `priority`.

### FAQ

**Do I need an external AI API key?**

No. Classification is built in and included in the event price.

**Can it reply to customers?**

No. It only classifies; your helpdesk or team replies.

### More Ferrolark tools

- [Criteria Checker](https://apify.com/ferrolark/criteria-checker)
- [Amazon Listing Checker](https://apify.com/ferrolark/amazon-listing-rules)
- [Brand Name Availability Checker](https://apify.com/ferrolark/brand-name-checker)

***

*Built by Ferrolark.*

# Actor input Schema

## `tickets` (type: `array`):

Up to 200 per run (max 8,000 characters each). Strings, or objects {"id", "subject", "body", "customerTier"}. Fields like channel and product are passed along as context.

## `departments` (type: `object`):

Map of team id to a short description of what it handles (2-100). Defaults: billing, technical, account, orders_shipping, sales, feedback.

## `customFlags` (type: `array`):

\[{"id": "gdpr", "instructions": "Is this a data deletion request?"}] - returned in tags and signals.

## `flagThreshold` (type: `string`):

Probability needed to raise a flag (urgent, churn risk...).

## `minDepartmentConfidence` (type: `string`):

Below this the ticket goes to manual-review instead of a team.

## `model` (type: `string`):

Classification model alias (default jev-latest). Pin a version such as jev-1.14.0 when you tune thresholds.

## `concurrency` (type: `integer`):

Parallel classification requests (capped at 4).

## Actor input object example

```json
{
  "tickets": [
    {
      "id": "T-1001",
      "subject": "Charged twice",
      "body": "I was billed twice this month. This is the third time I write, fix it or I cancel.",
      "customerTier": "pro"
    },
    {
      "id": "T-1002",
      "body": "Hola, ¿podéis añadir modo oscuro a la app?"
    }
  ],
  "flagThreshold": "0.7",
  "minDepartmentConfidence": "0.5",
  "model": "jev-latest",
  "concurrency": 4
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `files` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "tickets": [
        {
            "id": "T-1001",
            "subject": "Charged twice",
            "body": "I was billed twice this month. This is the third time I write, fix it or I cancel.",
            "customerTier": "pro"
        },
        {
            "id": "T-1002",
            "body": "Hola, ¿podéis añadir modo oscuro a la app?"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ferrolark/ticket-triage").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "tickets": [
        {
            "id": "T-1001",
            "subject": "Charged twice",
            "body": "I was billed twice this month. This is the third time I write, fix it or I cancel.",
            "customerTier": "pro",
        },
        {
            "id": "T-1002",
            "body": "Hola, ¿podéis añadir modo oscuro a la app?",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ferrolark/ticket-triage").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "tickets": [
    {
      "id": "T-1001",
      "subject": "Charged twice",
      "body": "I was billed twice this month. This is the third time I write, fix it or I cancel.",
      "customerTier": "pro"
    },
    {
      "id": "T-1002",
      "body": "Hola, ¿podéis añadir modo oscuro a la app?"
    }
  ]
}' |
apify call ferrolark/ticket-triage --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ferrolark/ticket-triage"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/wq4U4sOCSv3nYzou8/builds/4zJTTnqkfdgd50UTs/openapi.json
