Along with managing the script you can also link two different states or add an exception handler or add branches to a defined flow to your script on Flow Bot Builder. Let's look at each one of them.
You can link two different states using the link button. Here, there are 2 options
Goto
This is used to go to another state / point within the current flow. i.e. If you want to go to another point in the main flow, then use Goto.
To create a go to link, select the node from the tree view, select the “Link” button and then select 'Go to'
Now, to select your the destination state that you want to go to, click on the “Select Node” button, which opens the tree view. Select a node in the tree view.
Once selected, hit 'Done' and you should see the dotted blue line between the two linked nodes.
Note
There are few pointers to remember while using the Goto feature.
1. You should always create the link with a state above the state that needs to be executed.
Example: In the image below, for one of the options of the quick reply we want to send the bot response of the carousel. Hence we linked the user state of the quick reply to the state above that bot response.
You should only link a user state to a bot state like in the example above.
You can link a bot state to either a bot start or a user state.
Call
Only after you've created one or more flows, you can 'Call' a flow from a node, wherein the next step executed after the call, will be the first node of the called flow.
After you've setup a Call by selecting from the drop down
in the tree view, the called node will be represented with this icon
Note
Always ensure to Return the flow after it has been called OR link it further to a main flow, else your users will get stuck in a flow. Return is a good practice to ensure your flow returns from the point it was called, and then continues further on. There's a seperate section that talks about Return.
The concept of User Intent match is similar to the concept of “Exception handling” in the Bot Scripting tool. The user intent match can be added to a state with multiple branches(child nodes) like a quick reply or a carousel. You need to check the checkbox shown below to activate fallback matcher feature.
This is a very useful feature. Let's you have a quick reply with 2 options which then have their own branches like in the image below.
Now, lets user selects “shoes” at the start and the carousel is displayed to the user. But now the user enters “watches” instead of selecting any shoes from the carousel. By default, the bot will try to search for “watches” in the nodes of the carousel and if it's not found the bot will throw the default fallback message{need to add a link to another doc.} to the user.
To avoid this you need to check the User intent match option for the quick reply on the top. By doing so you will force the bot to go to the state where the User intent match is checked and search again.
Hence look at the screenshot below, when the user types “watch” after going into the flow of “shoes” the bot is able to go back to the top and initiate the “watches” flow.
You can create additional user states for both the quick reply and the carousel. These will not be part of the options displayed to the user. This is useful in handling user queries that are not part of the options of the structured messages.
For example: Let's take the same scenario that we discussed in the fallback matcher above. After selecting the “Shoes” at the start user might say “start over” to restart the flow. Now even with fallback matcher, this will throw the default fallback message because there is no such state at the top most quick reply.
To solve this problem you can create a new branch in the quick reply. Select the quick reply and then click on “User Says” in the script designer section. Then add the user message as “start over” and click “Done”. This will create a new branch called “start over”.
Once you have created the branch you can then link this to the same quick reply so that the user gets the first message of the flow.
Thus the end result will be like: