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

# Choose when a procedure runs

> A procedure runs on a customer message when three things hold: the conversation is in a place picked under Where it runs, its Only if conditions allow it, and the message fits its When to use.

A procedure runs on a customer message when three things hold: the conversation is in a place picked under **Where it runs**, its **Only if** conditions allow it, and the message fits its **When to use**. All three are at the top of the procedure, under **Procedures** in the sidebar.

This article is the reference for those settings. To build a procedure from start to finish, see [Build procedures](https://docs.aide.app/automation/scenarios.md).

## The order of the checks

1. **Where it runs** and **Only if** are checked first, before Aide reads the message. A procedure they rule out is not considered, whatever the customer writes.
2. Aide then scores the message against the **When to use** of every live procedure that is left. The best fit is followed, as long as it scores at least the procedure's threshold, 60% unless it was changed through the API.
3. Each customer message follows at most one procedure. When none fits well enough, Aide replies as usual.

## When to use

* Up to 300 characters. The counter beside the box shows how many you've used.
* Say what the procedure is not for in the same text, with "Not when …". Messages you rule out there are left to another procedure, or to Aide's usual reply.
* A procedure needs a **When to use** before it can be set live.

## Use when and Don't use when

Choose **Train on examples** to open two lists: **Use when**, for messages the procedure is for, and **Don't use when**, for messages that look alike but need something else.

* One customer message per line. You can paste a list.
* Each list takes up to 20 examples of up to 300 characters.
* **Check trigger** can add examples for you from real conversations (see [Test a procedure before setting it live](https://docs.aide.app/automation/test-a-procedure.md)).

## Where it runs

Nothing picked means **Everywhere Aide answers**. Pick whole channels, single inboxes or both, and tick a **Kind of conversation** to narrow them further. [Build procedures](https://docs.aide.app/automation/scenarios.md) lists every option.

## Only if

Conditions sit in groups. Inside a group every condition must be true; between groups, one matching group is enough. A procedure takes up to 20 groups of up to 20 conditions. Each condition uses "is" or "is not" ("matches" or "doesn't match" for a pattern).

| Condition | What it checks |
| - | - |
| **topic**, **highest topic**, **priority topic** | A topic Aide tagged the message with. **highest topic** is the message's top topic. |
| **topic confidence** | The top topic scored at least the value you pick: 80% to 97.5%, in steps of 2.5%. |
| **is first message** | The customer's first message in the conversation. |
| Ticket tags, status and fields | Also contact and user fields, and Salesforce contact fields when Salesforce is connected. |
| **Zendesk › group**, **Gorgias › team** | The helpdesk team handling the conversation. |
| **message or subject** | A pattern the message or subject matches. |
| Order conditions | The customer's newest order (see below). |

### Order conditions

* **order exists** and **tracking exists**
* **order status**: Not shipped yet, Partially shipped, Shipped, Delivered or Cancelled
* **order created**: in the past hour, or the past 2, 3, 4, 5, 6, 7, 8, 12, 16 or 24 hours
* **tracking begun** and **tracking last updated**: in the past week, or the past 2 to 8 weeks
* **shipment status**: Label purchased, Label printed, Confirmed, Carrier picked up, In transit, Out for delivery, Attempted delivery, Delayed, Ready for pickup, Delivered or Failure
* **order tag**, **destination country** and **tracking company**

Aide reads the customer's newest order, and only once it knows the order is theirs (see [How shoppers prove an order is theirs](https://docs.aide.app/shopify/order-verification.md)). Order status, tracking and the time windows are read as they were when the customer wrote. A parcel that shipped or was delivered after the message doesn't count for that message.

### How many conversations match

Under the conditions, the editor counts the conversations from the last 28 days that match them and lists up to five. When it only checked the newest ones, the count reads "About" or "At least". For this count, order conditions use each customer's newest order as it is today.

## Priority and delay

Both are under **Execution** on the procedure's **Activity** tab.

* **Priority**: **Low** runs only if no other matching procedure does. **Medium (default)** runs whenever it matches. **High** runs when it matches, and no other procedure's actions run.
* **Delay**: **Immediately**, or after 5, 10 or 15 minutes.

## Who can do this

Agents can edit a procedure that has never been live. Changing a live procedure and setting one live are for owners and admins.


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