> 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/workflows/workflow-conditions.md).

# Workflow conditions

## What are Workflow Conditions?

A workflow runs when an email matches a set of conditions you define. When a condition subject matches, it triggers one or more workflow actions.

{% content-ref url="/pages/VOXnDgu4EoUfOZIADH0m" %}
[Workflow actions](/help/workflows/workflow-actions.md)
{% endcontent-ref %}

## Runs when

Workflows can be triggered by email activity or by changes agents make to a ticket. You choose the trigger in the **Runs when** block.

<figure><img src="/files/TeXPF7qtG0ptjUpYF2R9" alt=""><figcaption><p>Runs When block in Keeping</p></figcaption></figure>

**Email triggers** run when email moves through Keeping:

* **Initial email is received** — runs once, when a new ticket arrives
* **Agent replies** — runs each time an agent sends a reply
* **Customer replies** — runs each time the customer responds
* **Initial email, agent replies, customer replies** — runs on every email in the conversation

**State-change triggers** run when an agent updates a ticket:

* **An agent applies a tag** — runs when a specific tag is added to a ticket
* **An agent assigns a teammate** — runs when a specific teammate is assigned
* **An agent sets a priority** — runs when the priority is set to Low, Medium, or High

When you choose a state-change trigger, a second dropdown appears where you pick the specific tag, teammate, or priority to watch for. The workflow won't run until you've chosen one. For tag triggers, the dropdown lists the tags available in the workflow's mailboxes.

## Condition Subjects

A workflow can match on the text of one (or more) of the following fields of an incoming email.

### Conversation Subject

The *conversation subject* is the text in the subject line of an incoming support email.

### Customer Name

In an incoming email, the *customer name* is the name inside the Reply-To of a customer email address. For example, in the email address \<Joe Smith, <joe@example.com>>, "Joe Smith" is the customer name. Not all incoming emails contain a customer name.

### Customer Email Address

In an incoming email, the customer email address is the email address inside of a customer's Reply-To. For example, in the email address \<Joe Smith, <joe@example.com>>, "<joe@example.com>" is the customer email address. All incoming emails should include an email address.

### Mailbox Email Address

This is the `to:` address on the incoming email. Normally this condition is not needed as you can specify the mailbox when creating a workflow. Use this condition when you have multiple email accounts forwarding into a single shared mailbox and you need to run rules on their original email address.

### Attachments

This special condition subject can match on whether there is (or is not) an attachment on an email.

### Ticket arrives on or after/before

This condition is used to process a ticket based on a tim&#x65;**-**&#x6F;f-day. Note that the day begins and ends at midnight. For example, if you create a condition to match "on or after" 20:00, then this would match when a ticket arrives between 20:00 and 11:59:59 that day. Similarly, creating a "on or before" rule would start at midnight up to the time you set.

Use the "AND" operator with two time conditions to create a window if you'd like to assign tickets based on a particular shift.

### Keeping AI detects message

Keeping can use AI to recognize emails that don't need a human reply. Add the **Keeping AI detects message** condition to a workflow and choose whether the message **is** (or **is not**) one of the following:&#x20;

* **Spam or irrelevant** — unsolicited or promotional email like cold sales outreach, available when the workflow runs on an initial email or a customer reply.
* **A thank-you** — a simple "thanks!" from a customer that needs no follow-up.
* **An automatic reply** — an out-of-office or other auto-generated response.&#x20;

The thank-you and automatic reply options are only available when the workflow runs on a customer reply, since they apply to responses on an existing ticket. Pair this condition with actions like closing the ticket or applying a tag to keep noise out of your queue.&#x20;

{% hint style="info" %}
Keeping AI is available in Keeping's **Advanced** and **Enterprise** plans.
{% endhint %}

### On every email

To run the workflow on all emails, use this condition. Note: It cannot be combined with other conditions.

### Tags

Use this condition to check for the presence (or absence) of one or more Keeping tags.

### Status

This condition can be used to check the status of a Keeping ticket. For example, you may want to run a Workflow that automatically assigns an agent when an email arrives that has the **pending** status.

### Priority

Use this condition to check the priority of a ticket. A priority can be either low, medium, or high.

### Assignment

This condition can check if a ticket is assigned or unassigned. For example, if a customer replies to a ticket and it is unassigned, you may want to assign a particular agent.

### Time passed since trigger

Add this condition to a workflow to introduce a specified delay, either in business or calendar hours, before proceeding. The workflow's "trigger" is set in the "Runs When" block at the beginning. If combined with other conditions, these will be evaluated after the delay.

For example, you could create a workflow that runs 72 hours after an agent's reply, with an additional condition that checks if the ticket status is pending. If it is, automatically change the status to "open" to prevent a buildup of tickets with the "pending" status.

## Condition Operators

For any Condition Subject (except attachments), you may use the following operators to match on the text within that field.

### Is equal to

*Is equal to* matches when the text you supply exactly equals the text in your Condition Subject. This operator is case sensitive.

For example: if you supplied the phrase “Bob’s burgers”, it would only match on “Bob’s burgers”, not on “bob’s burgers”, “bobs burgers”, "Bob's burgers are good", or “bob”.

### Is not equal to

*Is not equal to* matches when the text you supply exactly does **not** equal the text in your Condition Subject. This operator is case sensitive.

For example: if you supplied the phrase “Bob’s Burgers”, it would match on “Ralph”, “Pandemic”, “Bob”, “bob’s burgers”, but **not** on “Bob’s Burgers”.

### Contains

*Contains* matches when the text you supply is found anywhere in the Condition Subject. This operator is case **insensitive**.

For example: if you supplied the word “apple”, it would match on text like “Do you carry appleshirts?”, “I need an AppleTV”, or “Do you know what an apple is?”

### Does not contain

*Does not contain* matches when the text you provide is not present anywhere in the Condition Subject. This operator is case **insensitive**.

For example: if you supplied the word “apple”, it would match on strings like “Hello how are you?”, “I need a TV”, but **not** on “I need an AppleTV”.

### Starts with

*Starts with* matches when the condition subject starts with the text you supply exactly. This operator is case sensitive.

For example: if you supplied the word “bill”, it would match on “<bill@example.com>”, **not** on “<Bill@example.com>”, or “<jim@bill.com>”.

### Ends with

*Ends with* matches when the condition subject ends with the tex you supply exactly. This operator is case sensitive.

For example: if you supplied the word “example.com”, it would match on “<joe@example.com>”, but **not** on “<joe@example.com.au>”.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.keeping.com/help/workflows/workflow-conditions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
