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

# Triggers and automations

> Rules that act on tickets when they are created or updated, and on tickets that have waited too long.

## Triggers

A **trigger** runs right after a ticket is created or updated, when its conditions match. Set them up under **Settings › Triggers**.

* **Conditions** come in two groups: **Match all of** (every one must hold) and **Match any of** (at least one must, or leave it empty). Conditions can check the ticket (status, channel, type, assignee, team, tags, priority, subject, description, last message), the customer (name, email, phone), custom fields, and what just changed (**changed**, **changed to**, **changed from**).
* **Actions** run in order: set status or status category, assign a team or an agent, set priority, add an internal note, add, remove or set tags, send a webhook, send an email, send a Slack message.
* Triggers run top to bottom. When one changes the ticket, the list is checked again, but each trigger runs at most once per update, so two triggers can't loop.
* Every run shows on the ticket as **Trigger *name* ran**, with what it changed or why an action failed.

Emails and Slack messages can include ticket details with placeholders such as `{{ticket.number}}`, `{{ticket.subject}}` or `{{ticket.url}}`, with a fallback after a bar: `{{ticket.assignee_name | nobody yet}}`.

## Automations

An **automation** acts on tickets that have waited: it runs once an hour and checks every open ticket against conditions that start with a time, such as **Time since last customer message is more than 2 days**. Add the other conditions and actions the same way as a trigger. An automation acts on a ticket once per wait, and again only after the clock it measures starts over. Set them up under **Settings › Automations**.

## Webhooks and Slack

Under **Settings › Webhooks**, add the endpoints a trigger's **Send webhook** posts to, with optional custom headers and a JSON body written with the same placeholders (values are escaped for JSON). Each post is signed:

| Header | Value |
| - | - |
| `x-wiredesk-timestamp` | Seconds since 1970 when it was sent |
| `x-wiredesk-signature` | `v1=` followed by the HMAC-SHA256, in hex, of `timestamp.body` with the endpoint's signing secret |
| `x-wiredesk-delivery-id` | A unique id for this delivery |

The signing secret is shown once, when you add the endpoint. A failed post is tried three times. Add a Slack channel by its incoming webhook URL to use it in **Send Slack message**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.