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

# Ticket Triggers

> Create automated workflows when specific conditions are met in tickets

The Ticket Trigger System allows administrators to create automated workflows that execute when specific conditions are met in tickets. This feature is inspired by Zendesk's trigger system and provides a flexible way to automate routine actions.

## Components

### 1. Triggers

A trigger is a rule that consists of two parts:

* **Conditions**: Criteria that must be met for the trigger to activate
* **Actions**: Tasks that the trigger performs when the conditions are met

### 2. Condition Types

Conditions can be based on various ticket properties:

| Condition Type         | Description                                                   | Example                           |
| ---------------------- | ------------------------------------------------------------- | --------------------------------- |
| Ticket Status          | The current status of the ticket                              | Open, Pending, Solved             |
| Subject                | Text in the ticket's subject line                             | Contains "urgent"                 |
| Request Type           | The type of request                                           | Question, Problem, Incident       |
| Priority               | The priority level of the ticket                              | Low, Normal, High, Urgent         |
| Tags                   | Tags applied to the ticket                                    | Has tag "billing"                 |
| Channel                | How the ticket was created                                    | Email, Web Form, API              |
| Requester              | Details about the person who created the ticket               | Email domain, Group               |
| Custom Fields          | Values in any custom fields                                   | Department = "Sales"              |
| Requester Permission   | A permission granted to the requester                         | Has permission "vip"              |
| Requester Organization | The organization the requester belongs to                     | Organization is "ACME"            |
| Requester Agent Access | An AI agent the requester is allowed to use                   | Has access to "Billing Assistant" |
| AI Category            | The category the AI routing classifier assigned to the ticket | Category is "billing"             |

### 3. Operators

Operators define the relationship between condition types and their values:

| Operator         | Description                     | Example                         |
| ---------------- | ------------------------------- | ------------------------------- |
| Is               | Exact match                     | Status is "Open"                |
| Is not           | Not an exact match              | Priority is not "Low"           |
| Contains         | Text contains the value         | Subject contains "help"         |
| Does not contain | Text does not contain the value | Subject does not contain "spam" |
| Starts with      | Text starts with the value      | Subject starts with "Account:"  |
| Ends with        | Text ends with the value        | Subject ends with "needed"      |
| Greater than     | Value is greater than           | Replies greater than 3          |
| Less than        | Value is less than              | Time since update less than 24h |
| Is present       | Field has any value             | Description is present          |
| Is empty         | Field has no value              | Description is empty            |

### 4. Actions

Actions that can be performed when conditions are met:

| Action           | Description                                                                       |
| ---------------- | --------------------------------------------------------------------------------- |
| Set Status       | Change the ticket's status                                                        |
| Set Priority     | Change the ticket's priority                                                      |
| Set Type         | Change the ticket type                                                            |
| Assign to User   | Assign the ticket to a specific team member                                       |
| Assign to Team   | Assign the ticket to a team                                                       |
| Add Tags         | Add one or more tags to the ticket                                                |
| Remove Tags      | Remove one or more tags from the ticket                                           |
| Set Custom Field | Set a value for a custom field                                                    |
| Notify Requester | Send an email to the ticket requester                                             |
| Notify Staff     | Send an email to specific staff members                                           |
| Add Comment      | Add an internal note to the ticket                                                |
| Add Public Reply | Add a public comment to the ticket                                                |
| Invoke AGO Agent | Run a background agent on the ticket and post its answer back as an internal note |

## How Triggers Work

1. **Event Detection**: When a new ticket is created or updated, the system evaluates all active triggers.
2. **Condition Evaluation**: For each trigger, the system checks if all or any conditions (depending on configuration) are met.
3. **Action Execution**: If conditions are met, the trigger's actions are executed in the order they appear.
4. **Logging**: All trigger executions are logged for debugging and auditing purposes.

## Trigger Execution Order

The order of triggers matters, as the actions of one trigger can affect the conditions of subsequent triggers. Triggers are processed in sequential order based on their position value (lower position values are processed first).

## Example Use Cases

### New Ticket Auto-Response

**Conditions**:

* Ticket is created

**Actions**:

* Notify requester with a message: "Thank you for contacting us. Your ticket #{ticket.id} has been received."

### Urgent Support Request

**Conditions**:

* Subject contains "urgent" OR "emergency" OR "critical"
* Any condition must match (OR logic)

**Actions**:

* Set priority to "Urgent"
* Notify staff with message: "Urgent ticket #{ticket.id} from {ticket.requester.name} requires immediate attention."
* Add tag "escalated"

### Feedback Request After Resolution

**Conditions**:

* Ticket status changed to "Solved"

**Actions**:

* Notify requester with message: "Your issue has been marked as solved. Please let us know if you have any feedback on our service."

### Automatic Categorization

**Conditions**:

* Subject or description contains "password" AND "reset"
* All conditions must match (AND logic)

**Actions**:

* Set type to "Password Reset"
* Add tag "account-management"
* Assign to account management team

## Routing tickets to a team or a user

Triggers can send a new ticket to the right place as soon as it is created. Combine the requester conditions (permission, organization, agent access) and the **AI Category** condition with the **Assign to User** or **Assign to Team** actions.

For the **Assign to User** action, set the value to the team member's email or ID. For **Assign to Team**, set the value to the team name or ID.

### Example: route VIP billing questions

**Conditions** (all must match):

* Ticket is created
* Requester Permission contains "vip"
* AI Category is "billing"

**Actions**:

* Assign to Team "Billing"

## Running an agent on new tickets

The **Invoke AGO Agent** action hands a new ticket to a background agent so it can read the ticket and draft a first pass before a human picks it up.

When the trigger fires, the ticket gets an internal note with a link to the agent's run. Open the link to watch the agent work in a conversation view. When the agent finishes, its answer is added to the ticket as a second internal note (staff-only, never sent to the requester).

To set it up:

1. In **AI Studio > Agents**, open the agent you want to run and turn on **Background agent**. Only background agents appear in the action.
2. Create a trigger with the event **Ticket Created** (add conditions if you only want it on certain tickets).
3. Add the **Invoke AGO Agent** action and pick your background agent.
4. Optionally set an **Objective** to tell the agent what to do. Leave it empty for a default. It supports the same placeholders as other actions, for example `{{ticket.subject}}` and `{{ticket.body}}`.

If the agent needs approval to run a sensitive step, it pauses and the ticket gets a note linking to the approval. Approve it and the agent continues.

## AI routing categories

The **AI Category** condition relies on an AI classifier that reads each new ticket and assigns it one category from a list you define. You configure this per ticketing system:

* **Enable AI classification**: turn the classifier on or off for this ticketing system.
* **Prompt**: instructions that tell the classifier how to pick a category (for example, what each category means and edge cases to watch for).
* **Categories**: the list of categories the classifier can choose from, each with a name and a short description.

The classifier runs once per ticket, so its category is available to every trigger that references the **AI Category** condition. If classification is turned off or no category matches, the condition simply does not match and the rest of your triggers still run.

## Best Practices

1. **Test Thoroughly**: Before activating a trigger, test it to verify it works as expected.
2. **Use Position for Order Control**: Set position values carefully to control execution order.
3. **Limit Complexity**: Prefer multiple simpler triggers over complex ones with many conditions.
4. **Avoid Loops**: Be careful not to create triggers that could cause infinite loops (e.g., a trigger that fires when a ticket is updated and then updates the ticket).
5. **Monitor Performance**: Too many triggers can impact system performance, especially on busy instances.
6. **Maintain Documentation**: Keep a record of all triggers and their purposes for easier maintenance.

## Ticket Trigger Placeholders

When configuring trigger actions that send messages or notifications, you can use placeholders to insert ticket data dynamically:

| Placeholder                  | Description             | Example Value          |
| ---------------------------- | ----------------------- | ---------------------- |
| `{{ticket.id}}`              | Ticket ID               | `123`                  |
| `{{ticket.subject}}`         | Ticket subject          | `Login issue`          |
| `{{ticket.body}}`            | Ticket body/description | `I cannot log in...`   |
| `{{ticket.status}}`          | Current ticket status   | `open`                 |
| `{{ticket.priority}}`        | Ticket priority         | `high`                 |
| `{{ticket.typology}}`        | Ticket type/category    | `incident`             |
| `{{ticket.requester.email}}` | Requester's email       | `user@example.com`     |
| `{{ticket.requester.name}}`  | Requester's full name   | `John Doe`             |
| `{{ticket.created_at}}`      | Creation timestamp      | `2024-01-15T10:30:00Z` |

### Example: Notification Template

```
New {{ticket.priority}} ticket from {{ticket.requester.email}}

Subject: {{ticket.subject}}
Type: {{ticket.typology}}

{{ticket.body}}
```

## Limitations

* Triggers won't execute on closed tickets unless the trigger explicitly watches for ticket closures.
* Template variables for notifications are limited to ticket properties and basic user information.
* Complex conditions may need to be split into multiple triggers.

***

## When a trigger runs

Each trigger fires on one event, chosen with the **Trigger on** selector when you create it:

* **Ticket created** — runs once, when a new ticket comes in.
* **Ticket updated** — runs when an AGO-managed ticket changes: its status changes, it's assigned to a team member, or a staff member adds a reply. Tickets synced from an external system (such as Zendesk) don't fire "updated" triggers, since their changes come from that system.

Pick the event first, then add conditions and actions on top of it.

## How to Create Your First Trigger

1. Navigate to **Tickets** > **Settings** > **Ticket Triggers**
2. Click **New Trigger** to open the trigger page
3. Choose **Trigger on**: *Ticket created* or *Ticket updated*
4. Give the trigger a name (e.g., "Notify on high-priority tickets")
5. Add **conditions** — extra criteria the ticket must match (e.g., priority = high)
6. Add **actions** — what should happen (e.g., assign to a team, send an email)
7. Click **Save**
8. Test by creating or changing a ticket that matches your conditions and verifying the action fires

> **💡 TIP**: Start with a simple trigger to validate the workflow, then add more complex conditions.

***

## Related

* [Thread Triggers](./thread-triggers-feature) — Conversation-based automation
* [Ticketing](./ticketing) — Ticketing feature overview
* [AI Template Editor](./ai-template-editor) — AI-assisted template editing
