Skip to content

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. 1

    Add Switch

    Drag Switch onto the canvas, connect the step before into it, and click it.

  2. 2

    Set Value

    Under Value, enter what to check, for example #status (data from your system) or lower(trim(@answer)) (an answer, tidied up). See Expressions.

  3. 3

    Choose case handling

    Tick Ignore upper / lower case if Paid and paid should count as the same.

  4. 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 as value > 100. Click Add case for more. Cases are checked top to bottom; use Move up and Move down to change the order.

  5. 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#

ProblemWhyFix
The chat always goes to DefaultThe value is empty or different from what you expectUse Test expression with real sample values; check spelling and Ignore upper / lower case
An Equals case never matchesYou typed quotes, such as "paid"Type paid without quotes
The wrong case winsTwo cases match, and the first one winsPut the stricter case higher, for example value > 100 above value > 50
002 matches the case 2Equals compares numbers as numbersUse 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 existPick it from the @ or # list
The step shows it isn't readyValue or a case is empty, or an output isn't connectedFill 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.