Conditional branch

更新时间:
复制 MD 格式

This topic describes how to configure the conditional branch component. This component uses multiple conditions to change the execution path of a flow.

Component information

Component icon

Component name

条件分支@1x

Conditional branch.

Prerequisites

To configure this component, access the flow canvas by using an existing flow or creating a new one.

  • Go to the canvas of an existing flow

    In the Chat Flow > Flow Management > Flow Name

  • Create a new flow to open its canvas. For more information, see Create a flow.

Procedure

  1. On the canvas, click the conditional branch component icon to open the component configuration panel on the right.

    In the conditional branch configuration panel, the available variables section lists five variables: incomingMessage, wabaId, wabaPhoneNumber, customerPhoneNumber, and customerName. In the branch configuration section, set the And condition logic for Branch_A and add more branch paths by clicking Add new branch. After you complete the configuration, click Save at the top of the page.

  2. Configure the component parameters as required. For detailed information about the parameters, see Parameter descriptions.

  3. After you finish the configuration, click Save. In the dialog box that appears, click Save.

Configuration item descriptions

To add a new branch, click Add Add Branch. Configure the branch rules as follows:

Configuration item

Description

Example

And/Or

If a branch contains multiple rules or rule groups, use And/Or to define how the rules are evaluated.

  • And: All rules or rule groups must be satisfied.

  • Or: Any one rule or rule group must be satisfied.

And example: This example means that both conditions—userChooseLanguage equals English and incomingMessage contains English—must be true to execute the next step.

image

Or example: This example means that either condition—userChooseLanguage equals English or incomingMessage contains English—can be true to execute the next step.

image

Add rule, Add rule group

In a branch, click imageAdd rule. Each rule includes Please select a variable, Please select an operator, and Enter a value. You can also click imageAdd rule group in a branch. A rule group can contain multiple rules and nested rule groups. Each rule group must start with an And/Or condition to define how its rules are evaluated.

image

Please select a variable

Select the variable to evaluate from the variable dropdown list. Variables come from the default available variables and any custom variables you have defined. For more information, see How to use available variables.

Please select an operator

Select the desired rule from the Please select an operator dropdown list. Available operators include the following:

  • stringStartsWith: String starts with.

  • numberLessThan: Number is less than.

  • stringAnyMatchesRegex: String partially matches a regular expression.

  • stringEquals: String equals.

  • stringEqualsIgnoreCase: Strings are equal, ignoring case.

  • stringIsNumber: String is a number.

  • numberEquals: Number equals.

  • stringContains: String contains.

  • stringIsBlank: String is empty.

  • stringIsNotBlank: String is not empty.

  • numberGreaterThan: Number is greater than.

  • stringEntireMatchesRegex: String fully matches a regular expression.

Enter a value

Enter your custom matching value.

Component configuration example

image

This example shows:

  • If the user input matches the condition for the Chinese branch, a message in Chinese is sent and the flow continues.

  • If the user input matches the condition for the English branch, a message in English is sent and the flow continues.

  • If the user input does not match any of the branch conditions, the else branch is executed, and the flow continues from the connected node.