Switch
Send the chat down different paths depending on one value, such as an order status or an answer.
What it does#
Switch looks at one value, such as an order status or a customer's answer, and sends the chat down the path of the first case that matches. If nothing matches, it follows Default. The customer doesn't see this step.
Use it when one value decides the path: paid, pending or cancelled. To check several things at once (for example city and age), use Filter. If you don't see Switch in the Steps panel, it isn't available in your account yet.
Set it up#
- 1
Add Switch
Drag Switch onto the canvas, connect the step before into it, and click it.
- 2
Set Value
Under Value, enter what to check, for example
#status(data from your system) orlower(trim(@answer))(an answer, tidied up). See Expressions. - 3
Choose case handling
Tick Ignore upper / lower case if Paid and paid should count as the same.
- 4
Configure Cases
Under Cases, choose how each case matches: Equals for a fixed value (type
paid, without quotes), or Condition for a rule such asvalue > 100. Click Add case for more. Cases are checked top to bottom; use Move up and Move down to change the order. - 5
Connect every output
Connect each case and Default to a next step. Use Test expression with Sample variables and Run to check a value, then click Preview.
What your customer sees#
Nothing from the Switch itself. The chat moves straight on to the step connected to the matching case, or to Default.
Common problems#
| Problem | Why | Fix |
|---|---|---|
| The chat always goes to Default | The value is empty or different from what you expect | Use Test expression with real sample values; check spelling and Ignore upper / lower case |
| An Equals case never matches | You typed quotes, such as "paid" | Type paid without quotes |
| The wrong case wins | Two cases match, and the first one wins | Put the stricter case higher, for example value > 100 above value > 50 |
| 002 matches the case 2 | Equals compares numbers as numbers | Use a Condition if leading zeros matter |
| Unknown name. Check the spelling, or type @ to pick from the list. | The value uses an answer or variable that doesn't exist | Pick it from the @ or # list |
| The step shows it isn't ready | Value or a case is empty, or an output isn't connected | Fill them in and connect every case and Default |
Example#
Appointment status. Set Value to #status, sent by your booking system. Add Equals cases confirmed, pending and cancelled, each connected to a matching message, and connect Default to Talk to a person.