# 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="workflow-actions" %}
[workflow-actions](https://docs.keeping.com/help/workflows/workflow-actions)
{% endcontent-ref %}

## Runs When

Workflows run when email moves through the Keeping system. You can choose what type of email should trigger a workflow in the **Runs When** block.

<figure><img src="https://1058495162-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCHa8WIsJ5Z5NqmPmq5VS%2Fuploads%2Fj655l5KUt12tMYJqTAcW%2FRuns%20When.png?alt=media&#x26;token=0399295f-b10d-475f-87a7-de9d3cef1556" alt=""><figcaption><p>Runs When block in Keeping</p></figcaption></figure>

You can configure your workflow to run when:

* The initial email is received
* The agent replies
* The customer replies
* Any of the above events occur

## 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 a "Thank You" response

This condition activates only when a customer replies. Once enabled, Keeping AI will analyze the customer's response to determine if it is a simple "Thank You" (or similar message) that doesn't require further action. You can then create a Workflow Action to automatically close the ticket, apply a tag, or take any other specified action.

This condition can only be applied when you have chosen when the **Customer replies** setting is set for **Runs when**.

{% hint style="info" %}
Keeping AI Thank You Detection 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
