> For the complete documentation index, see [llms.txt](https://docs.keeping.com/help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeping.com/help/automate-your-inbox/what-are-workflows/workflow-conditions.md). Agents can also search and read this documentation through its [MCP server](https://docs.keeping.com/help/~gitbook/mcp).

# Triggers and conditions

Understand how the various conditions match when using a Workflow.

A trigger decides when Keeping checks a workflow. Conditions narrow which tickets match. Open a workflow's **Conditions** step to choose both.

## Choose a trigger

| Runs when                                            | When the workflow is checked              |
| ---------------------------------------------------- | ----------------------------------------- |
| **Initial email is received**                        | A new ticket arrives.                     |
| **An agent replies**                                 | An agent replies to the customer.         |
| **A customer replies**                               | A customer replies to an existing ticket. |
| **Initial email, agent replies or customer replies** | Any of those email events occurs.         |
| **An agent applies a tag**                           | An agent applies the selected tag.        |
| **An agent assigns an agent**                        | An agent assigns the selected person.     |
| **An agent sets a priority**                         | An agent sets the selected priority.      |

The last three triggers require a tag, agent or priority selection and do not have additional conditions. Email triggers offer the conditions below.

## Combine conditions with AND and OR

Use **+ OR** for alternatives within a block. At least one condition in that block must match. Use **+ AND** to add another block; every block must match.

For example, **subject contains order OR subject contains return**, followed by **AND assignment is unassigned**, matches unassigned order or return questions. A ticket that already has an agent will not match that example.

{% hint style="warning" %}
**Put each "is not" condition in its own block.** Conditions in a block are joined with OR, so **customer email address is not equal to <a@example.com> OR customer email address is not equal to <b@example.com>** matches almost every email: each address fails one condition but passes the other. When a block has two or more "is not" conditions, the editor warns you and offers to split them into separate blocks with one click.
{% endhint %}

## Available conditions

| Condition                       | What it checks                                                                                                                                                                                                       |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Conversation subject**        | The ticket's subject.                                                                                                                                                                                                |
| **Message body**                | The email's text.                                                                                                                                                                                                    |
| **Customer name**               | The customer's name.                                                                                                                                                                                                 |
| **Customer email address**      | The customer's email address.                                                                                                                                                                                        |
| **Mailbox email address**       | The shared mailbox address.                                                                                                                                                                                          |
| **Attachment(s)**               | Whether the email includes an attachment.                                                                                                                                                                            |
| **Ticket arrives on or before** | An arrival time, in the selected time zone.                                                                                                                                                                          |
| **Ticket arrives on or after**  | An arrival time, in the selected time zone.                                                                                                                                                                          |
| **On every email**              | Every email covered by the chosen trigger, without another filter.                                                                                                                                                   |
| **Tags**                        | Whether the ticket contains or does not contain selected tags.                                                                                                                                                       |
| **Status**                      | Whether the ticket is Open, Pending or Closed.                                                                                                                                                                       |
| **Priority**                    | Whether the ticket has Low, Medium or High priority.                                                                                                                                                                 |
| **Assignment**                  | Whether the ticket is Assigned or Unassigned.                                                                                                                                                                        |
| **Awaiting an agent's reply**   | Whether a customer reply is awaiting a response. Available with **A customer replies**.                                                                                                                              |
| **Keeping AI detects message**  | Whether the message is spam or irrelevant, an automatic reply, or a thank-you. Available only with the required Keeping AI access and supported email triggers; thank-you detection requires **A customer replies**. |
| **Time passed since trigger**   | A delay of 1–800 hours, measured in calendar or business time.                                                                                                                                                       |

## Text matching

Text fields offer **Is equal to**, **Is not equal to**, **Contains**, **Does not contain**, **Starts with** and **Ends with**.

**Contains** and **Does not contain** ignore capitalization. Equality, start and end comparisons are case-sensitive. For example, **Contains → order** matches “Order update,” while **Starts with → order** does not match that capitalized subject.

## Delayed actions

Use **Time passed since trigger** when an action should wait rather than run immediately. Choose the number of hours and **Calendar** or **Business** time. For business-time rules, configure your [business hours](https://docs.keeping.com/help/manage-your-workspace/set-your-business-hours.md) and the mailbox's time zone first.

**Related guide:** [Workflow actions](https://docs.keeping.com/help/automate-your-inbox/what-are-workflows/workflow-actions.md).
