> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fyno.io/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fyno.io/docs/_mcp/server.

# AI Magic Match Widget within a Workflow

> Configure the AI Magic Match widget to understand what a user is asking for and route the workflow to the matching branch.

The **AI Magic Match** widget is used to read a user's message, understand what they are asking for, and continue the workflow on the branch that matches it.

It matches by meaning, not exact words. For example, "Where is my order?" and "Please share the latest update on my order" are worded differently but both ask for the order status, so both go down the same branch.

This is useful for handling customer queries, routing requests to the right follow-up message, or telling apart requests such as order status, cancellations, refunds, or delivery agent details.

Users can configure the widget using:

* User Input
* Conditions

![AI Magic Match widget in a workflow](/docs/_fern-files/_img/8b08ea7a6148ee34b9684e94f536f9aad7ca97dfe206f4b4cd5c1cd569934a54.webp)

Each condition adds an **If** branch to the widget, numbered in order (1st, 2nd and so on). The last branch is **Else**, which the workflow follows when the user's message does not match any condition.

## Steps to configure AI Magic Match Widget

![AI Magic Match configuration](/docs/_fern-files/_img/6956f563206d92d0aa7c0f61a4868576264266f67650537ef8d50fe94ad48079.webp)

Drag and drop the **AI Magic Match** widget into the workflow and connect it to the workflow step that receives the user's message.

Select the **User Input**.

Choose the variable that contains the user's message. This is the text the widget reads and compares against your conditions.

Example:

```text
{{$input.body.message}}
```

Click **ADD CONDITION** and enter a **Condition Name**.

Use a short name that describes the request.

Example:

```text
order_status
```

Under **If user input is similar to**, describe the kind of message that should match this condition.

Click **ADD** to add more descriptions to the same condition. To remove one, click the **X** next to it.

Example:

```text
Customer wants to know the status or location of their order
Customer wants the delivery agent details
```

Repeat the previous two steps for each request you want to handle, such as cancellations or refunds. Each condition adds its own branch to the widget.

To remove a condition, click the delete icon next to it.

Connect the next workflow steps to each branch, including **Else**, so every message is handled.

Save the workflow configuration.

Once configured, the workflow will read the user's message and continue on the branch of the matching condition, or on **Else** if nothing matches.

## Test Magic Match Conditions

Before going live, check that your conditions match the messages you expect.

![Test Magic Match Conditions](/docs/_fern-files/_img/09d51d7627051bcc2e2c5a3803896eca84f3871e7ace89d2343a4e9f6e541f4e.webp)

Open **Test Magic Match Conditions**.

Enter a sample message, written the way a user would type it.

Example:

```text
I want to check my order status. Please share the latest update on my order.
```

Click **Run Test** to see which condition the sample message matches.

If it matches the wrong condition, or none, update the descriptions under **If user input is similar to** and test again.

## Example

| User message                   | Matched condition | Result                                         |
| ------------------------------ | ----------------- | ---------------------------------------------- |
| Where is my order?             | order_status      | Workflow continues on the order_status branch. |
| Who is delivering my parcel?   | order_status      | Workflow continues on the order_status branch. |
| Do you have this sofa in blue? | None              | Workflow continues on the Else branch.         |

> **Note**
>
> Describe the intent in plain words, like "Customer wants to cancel their order", instead of listing exact messages. Adding two or three descriptions that cover different ways of asking helps the widget match more accurately.