Create Flow Conditions - Routes
Routes allow you to split the flow into multiple branches by applying if-else conditions to the end user's response to a follow-up question or to the value of a parameter obtained from an API call.
When setting a Route, you need to:
- Create the Intent that will serve as the destination route when the data stored in the variable designated in the follow-up question's Key Name matches with the text entered in the Route Key field. This process utilizes AI-powered string matching.
- In the follow-up question, in the Route Key field, configure the text and select an Intent from the dropdown menu.
A few examples where routes can be used as:
Case 1: Splitting the flow based on the user response to a question
In this case, routes should be specified within the same follow-up question where the prompt is configured (the actual question). The user's response will then be saved in the variable defined under Key Name, enabling you to route the flow based on the value of this variable.
For example:
In the example's screenshot, we are asking the end user if they want to order Pizza or Chicken and we are storing their reply in a variable called food. In the Routes section, we configure the flow to respond differently based on the end-user's reply. If the user's response is 'pizza,' the flow will progress to the Pizza Question/Intent, where we might ask additional questions or perform specific actions. Conversely, if the response is 'chicken,' the flow will proceed to the Chicken Question/Intent. If the user's response doesn't match 'pizza' or 'chicken' as defined in the Routes, an error message can be sent to the end user, which should be added in the retry message field. After three consecutive errors, the message in the Final Retry field will be sent, and the end user will exit the intent. For example:
Case 2: Splitting the flow based on an API response
In this case, routes should be specified within the same follow-up question where the API call is made. Please refer to the API Requests and Responses - Response Callback and Response Callback Message section for an example.
Case 3: Route an end user to a specific Intent regardless of the user’s or API response
After a follow-up question, if you wish to direct an end user to a specific Intent regardless of the user’s or API response, you can create a single Route and set the Key to '0'. For example:
Lastly, 'default' can be specified as a Route Key, alongside other Keys. 'default' serves as a fallback route in case the end user's response or data obtained from an API doesn't match any of the other routes.
Updated 11 months ago