Transition condition

A Transition Condition in a bot-builder flow is a rule or set of rules that determine when the chatbot should move from one node or stage of the conversation to another. Defining transition conditions allows for a more dynamic and interactive conversation with the user. By setting specific conditions, you can ensure that the chatbot only progresses to the next stage of the dialogue when certain criteria are met, thus ensuring a more logical and engaging user experience. You set a condition based on different parameters such as user input, session data, or even external API data. When this condition is met, the bot will transition to a predefined node or stage in the conversational flow.

  • Access the Node where you wish to set up a transition condition.
  • In the inspector pane navigate and click on Transitions tab.
  • This will open New condition to Transition window.

Transition conditions

  • Here you can define the condition and conversation path when condition is met.

Condition Types

  • Always: Select Always to create a transition that will always execute after the current node.
  • Intent Is {intentName}: You can optionally include an intent check. Choose Intent Is [intentName] to specify a transition that should occur when a particular intent is recognized.
  • Matches Property: Matches Property condition is a rule used in bot-building to check if a specific property or attribute associated with a user's data or input aligns with predefined criteria. It is employed to customize a bot's responses or actions based on user-specific information, enabling customized interactions and decisions.

Transition Matche Property

If You are setting up a movie booking bot that needs to verify the user's age before allowing them to book tickets for age-restricted films. You can set

  • Field Name: age

  • Expression: Use >= 18 to set the condition that the user's age must be 18 or older.

  • Expected Outcome: If the user's age is 18 or above, the bot will continue with the booking process. If less than 18, the bot will show age restrictions.

  • Raw Expressions (advanced): A Raw Expression allows you to create custom conditions for your chatbot's transitions during a conversation. This field is for when you need to execute a piece of custom JavaScript code that determines whether to take the transition.

    • Insert Variable: Click on Insert Variable to bring up a list of available variables that you can use in your expression. These variables can represent data collected from the user or the current state of the conversation. Or
    • Write the Condition: In the input field that appears, write the condition using the variables you've inserted. The chatbot will use this condition to decide whether to proceed with the transition. For Example, the expression-

!isNaN(Number(event.payload.text)) && Number(event.payload.text) > 0

verifies that the user's input is a numerical value greater than zero. If this condition is true, the bot will follow the designated transition path.

Transition Actions

Next, specify what actions the bot should take when the condition is met.

  • End Flow: This action effectively concludes the conversation.
  • Return to Previous Flow: This action sends the conversation back to the prior state in the conversation based on the user's input.
  • Transition to Node: This action moves the conversation to a specific node. Select the node from the dropdown menu that appears when this option is selected.
  • Transition to Subflow: This action sends the conversation to a different subflow. Select the Subflow name from the dropdown menu that appears when this option is selected.