> For the complete documentation index, see [llms.txt](https://docs.wonderchat.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wonderchat.io/setup-guides/adding-chatbot-workflows/set-up-chatbot-workflows.md).

# Set-up Chatbot Workflows

How to create a workflow for your agent, from a template or from scratch: choose when it runs, add steps, branch on conditions and test it.

A workflow tells your agent what to do in a specific situation, step by step. This page walks through creating one, choosing when it runs, adding steps and testing it.

{% hint style="info" %}
Workflows are available on paid plans. How many workflows each agent can have depends on your plan:

* **Starter**: 1
* **Basic**: 2
* **Scale**: 10
* **Enterprise**: 20

The Workflows tab shows how many you've used, for example **1 of 2 workflows**.
{% endhint %}

***

## Step 1: Open the Workflows tab

1. Go to **Agents** and click **Edit** on your agent's card.
2. In the settings sidebar, open **Workflows** (in the **Agent** group).

You'll see your workflows, each with its trigger, its number of steps and an on/off switch.

<figure><img src="https://3760420285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0WUvfmkdMPXz3x7NXP8i%2Fuploads%2Fgit-blob-0a2338fcf9ce86326ec89598fb8399fe1352f147%2Fworkflows-tab-list.png?alt=media" alt="The Workflows tab with a list of workflows and the New workflow button"><figcaption><p>The Workflows tab</p></figcaption></figure>

***

## Step 2: Add a workflow

Click **New workflow**. (If the agent has no workflows yet, the options below show on the tab straight away under **Create your first workflow**.)

The **Add a workflow** window gives you two choices:

* **Start from scratch**: an empty workflow where you choose your own trigger and steps.
* **Or start from a template**: a ready-made workflow you can use as is or change.

<figure><img src="https://3760420285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0WUvfmkdMPXz3x7NXP8i%2Fuploads%2Fgit-blob-aa642a6a5605927d338d071f36bffb11f71c6465%2Fworkflow-template-picker.png?alt=media" alt="The Add a workflow window with Start from scratch and a list of templates"><figcaption><p>Start from scratch or pick a template</p></figcaption></figure>

### Templates

| Template                    | What it does                                                                                                                    |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Book a demo**             | Asks for the visitor's name and email, then shares your booking link.                                                           |
| **Qualify and route leads** | Answers the question, asks for an email and scores the lead. Hot leads get your booking link and your sales team gets an email. |
| **Request a quote**         | Asks what they need, their name and email, then emails your team.                                                               |
| **Report a problem**        | Suggests a fix and asks if it worked. If it didn't, it opens a ticket for your team.                                            |
| **Refund or return**        | Explains your policy, asks for the order number and the reason, then opens a ticket.                                            |
| **Cancellation request**    | Asks why they want to cancel. If it's about price, it shows your offer. Otherwise it explains how to cancel.                    |
| **Ask for feedback**        | Runs a short satisfaction survey.                                                                                               |

Some templates ask for a detail before they're added, such as your **Booking link**, the email address to **Send new requests to**, or **Your offer**. Fill it in and click **Add workflow**.

{% hint style="info" %}
**Qualify and route leads** uses AI lead scoring, which is available on the **Scale** plan and above. You can add the workflow on any plan, but until lead scoring is on, every lead follows the **Otherwise** path.
{% endhint %}

***

## Step 3: Choose when it runs

Click a workflow to open it. Give it a **Name**, then set its trigger under **When it runs** > **Starts when**:

| Trigger                        | What it does                                                                                                           |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| **AI recognises a situation**  | The AI reads each visitor message and starts the workflow when it matches the situation you describe, in any language. |
| **Visitor uses certain words** | Starts when a visitor message contains any of your words or phrases.                                                   |
| **After some messages**        | Starts once the visitor has sent a set number of messages, whatever they say.                                          |

For **AI recognises a situation**, write the situation in **Describe the situation**, for example "The visitor asks to book a demo or talk to sales". You can also add real example messages under **Should start it** and **Shouldn't start it**. They're optional, but they make the AI more accurate.

For **Visitor uses certain words**, add your **Words or phrases**. Add the same word in other languages if you have visitors from other countries.

For **After some messages**, set how many visitor messages to wait for.

<figure><img src="https://3760420285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0WUvfmkdMPXz3x7NXP8i%2Fuploads%2Fgit-blob-8de109fac47f2bd7c52c74a9cd1e71e0596c34f6%2Fworkflow-builder.png?alt=media" alt="An open workflow showing the When it runs section and its steps"><figcaption><p>An open workflow: when it runs, and its steps</p></figcaption></figure>

### Repeats and priority

* **Run once per chat**: the workflow won't start again in the same conversation.
* **Let saved corrections override this**: if one of your saved corrections covers the same question, the agent answers with the correction instead of running the workflow.

***

## Step 4: Add steps

Under **Steps**, click **Add the first step** (or **Add step** to add another). The **Add a step** window groups the steps by what they do:

<figure><img src="https://3760420285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0WUvfmkdMPXz3x7NXP8i%2Fuploads%2Fgit-blob-b04a8181b3c10a1d8d5ddf0f318ecedc579d20fa%2Fworkflow-add-step.png?alt=media" alt="The Add a step window with groups of steps"><figcaption><p>Pick a step to add</p></figcaption></figure>

| Group                      | Steps                                                                                                                                                                                              |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Ask the visitor**        | **Ask for email**, **Ask for name**, **Ask for phone number**, any of your custom lead fields, **New field**, **Ask a question**, **Confirmation checkbox**, **Ask for a rating**, **Show a form** |
| **Reply**                  | **Send a message** (a fixed message you write) and **Let the AI answer** (the AI replies, following your instructions)                                                                             |
| **Logic**                  | **Branch on a condition** and **Score this lead** (hot, warm or cold)                                                                                                                              |
| **Hand over to your team** | **Show the handover form**, **Connect to a live agent** and **Email your team**                                                                                                                    |
| **Send to your tools**     | Your custom API calls, **New API call**, and steps for connected tools such as Shopify, HubSpot and Zendesk                                                                                        |

A workflow can only have one handover step (**Show the handover form** or **Connect to a live agent**). Tool steps show **Connect … first** until you connect that tool in the **Tools** tab.

### Step settings

Each step has its own settings once added. A few worth knowing:

* **Ask for…** steps have two switches:
  * **Wait for an answer** (on by default). When it's off, the visitor can keep chatting and the workflow picks up once they answer.
  * **Ask even if we already have it**. When it's off, the step is skipped if the visitor already gave this detail.
* **Ask a question**: choose **I'll write the question** or **Let the AI word it**.
* **Let the AI answer**: write what the AI should do in **Tell the AI what to do**, for example "Recommend two products from the knowledge base that fit what they need". **Show source links** (on by default) adds "Read more" links when the agent cites your sources.
* **Email your team**: add addresses under **Send to**. Each address gets the chat and any details the visitor gave.

### Branch on a condition

A branch sends the conversation down different paths. Each path has a condition, written as a sentence, for example "If **the visitor's last message** **means** **yes, or agrees**". You can check:

* the visitor's last message, an answer to an earlier question, or a confirmation checkbox
* details the visitor gave, such as their email or a custom field
* the result of a tool step, or the lead score

Use **means** to let the AI judge the meaning, or exact rules such as **is**, **contains**, **is filled in**, **is more than** or **is checked**.

* Click **Add path** to add another path. You can name each path (optional).
* **Otherwise** runs if no path above matches.
* Add steps inside each path. A path can contain another branch, up to two levels deep.

### Move, replace or delete steps

* Drag a step by its handle to move it anywhere in the workflow, including into or out of a branch path.
* Open a step's **⋯** menu to **Replace with another step** or **Delete step**.

***

## Step 5: Save and test

1. Click **Save** at the bottom of the page.
2. Click **Test in preview** on the open workflow (or in a workflow's **⋯** menu) to run it in the preview chat without typing a trigger message.

You can also test it the way a visitor would: send a message that should trigger it in the preview chat.

***

## Manage your workflows

From the workflow list you can:

* Turn a workflow on or off with its switch.
* Use the **⋯** menu to **Test in preview**, **Duplicate** or **Delete workflow**.

***

If you have any more questions, feel free to reach out to us at <mark style="color:purple;">**<support@wonderchat.io>**</mark>
