Skip to main content

Branch

The Branch node allows you to create conditional paths in your Canvas flow. It evaluates conditions and directs the flow to different paths based on the result.

Empty Branch Node

Branch node properties are divided into three tabs: Selection, Branches, and Variables

Selection

This is where you define the conditions for branching.

Branch Node

You can choose from five methods to determine the path:

  1. Button: Present users with clickable options to choose their path.
  2. AI: Let AI analyze the user input and determine the appropriate path.
  3. Button + AI: Let AI analyze the user input and determine the appropriate path. If AI cannot find a match, it will show the buttons.
  4. Contains: Check if the user input contains specific phrase.
  5. Regex: Use regular expressions to match patterns in user input.
Branch Selection Options

You can find the detailed explanation of each method below

Button

This method shows buttons to the user to choose the path. When the user clicks on a button, the flow will continue on the path that corresponds to the button.

When you select the Button method, you can define the button options in the Branches tab and connect them to the desired paths.

Button settings
info

When you select the Button method, you can display a message to the user before showing the buttons in the Selection tab. This message can help guide the user in making a choice.

Button sample

AI

This method uses AI to analyze the user input and determine the path. AI will try to match the user input with the defined branches and select the appropriate path. The AI method is useful when you want to handle a wide range of user inputs and provide a more flexible branching logic.

AI branching settings

Here is a sample of the AI method in action:

AI CanvasAI Success
1. Didn't understand message

When you select the AI method, you can display a message to the user when the AI cannot find a match in the Selection tab. This message can provide a more engaging experience for the user.

AI didn't understand message
2. Maximum Tries

If the AI cannot find a match, the flow will drop to the Else path. You can select the number of retries before dropping to the Else path in the Selection tab.

Else Node

Button + AI

This method combines the Button and AI methods. The AI will analyze the user input and determine the path. If the AI cannot find a match, the flow will show the buttons to the user.

It has the same settings as the AI method, but the branches you define in the Branches tab will be displayed as button options as well.

This method is useful when you want to provide a more flexible branching logic with the AI method and still give users the option to choose their path with buttons when the AI cannot find a match.

AI branching settings

Here is a sample of the Button + AI method in action:

Button AI CanvasButton AI Sample

Contains

This method checks if input entered into the Value field contains the defined phrase. If the input contains the defined phrase, the flow will continue on the path.

This method is useful when you want to match specific keywords or phrases in the user input.

Contains settings

Here is a sample of the Contains method in action:

Contains CanvasContains Sample Chat
warning

The Contains method is not case-sensitive but it is sensitive to spaces and punctuation. Make sure to define the phrases correctly in the Branches tab to match the user input.

Regex

This method uses regular expressions to match patterns in the Value field. If the input matches the defined regular expression, the flow will continue on the path.

This method is useful when you want to match complex patterns in the user input.

Regex settings

Here is a sample of the Regex method in action:

Regex CanvasRegex Sample Chat
warning

Regular expressions can be complex and error-prone. Make sure to test your regular expressions thoroughly to ensure accurate matching.

Make sure your regular expressions are compatible with the JavaScript regex engine.

Branches

This is where you define the paths for the conditions you set in the Selection tab.

The branches you define here will be connected to the Selection tab based on the method you choose and will have different effects based on the method.

Branches Tab

Variables

Here you can rename and decide to keep or discard the output chosen by the branch.

Branch Node Variables

Best Practices

Rules of thumb
  1. Choose the appropriate branching method based on your flow's complexity and user interaction needs.
  2. Craft your conditions carefully to ensure accurate branching.
  3. Use meaningful labels for your paths to make your flow easier to understand and maintain.
  4. Test your conditions thoroughly to ensure accurate branching.
  5. Consider combining multiple Branch nodes for complex decision trees.