Bot initiatives
Bot-initiatives are a flow/sequence of bot-turns that are executed in order. They are called initiatives because the bot always starts, i.e takes the initiative, by making some action. Usually by saying something to the user.
If you bot is small and you only have one Narrative, your (one) flow of bot-initiatives will typically start with the bot greeting the user and end with a goodbye. For larger bots where you have split the dialog into several Narratives, it is up to you to decide how each flow starts and ends.
This screenshot from the Narratory Builder shows an example of a narrative called "Initial" with three Bot Initiatives (Greeting, Query Name and Goodbye):
#
Types of bot turnsBot turns comes in three variants;
- Reply: an output-only bot turn
- Request: a bot turn which is followed by a user turn (named from requesting something from the user). The bot will hand over the turn to the User.
- Bridge: a bot turn which is followed by another bot turn
You select the type of each bot-turn with the dropdown menu - the block will change shape accordingly:
#
Hello world - a first bot turnThe Narratory example of Hello world is a narrative with a single bot turn of type reply:
If you supply more than one text-block, Narratory will randomly pick one of them:
We recommend adding a few different variants to every bot output since repetition can bore and irritate users.
#
Request - Adding user inputThe next step is to add answers to our bot turn. To do this, we change the type of our bot turn block to request and add one or several user turns to our bot turns's user input as shown here:
Each UserTurn takes two inputs, an intent (see NLU / Intents docs to learn how to create intents) containing example phrases of what the user can say to trigger this UserTurn, and one or several followup BotTurns.
Here we have added two user-turns, one triggered by the user saying "yes" and one for the user saying "no".
#
Combining turns to sub-dialogsYou can combine bot turns and user turns creating sub-dialogs like shown here:
Note We strongly recommend to not build sub-dialogs with a depth larger than the above since it quickly can become overwhelming to navigate. Instead, we recommend splitting large sub-dialogs into separate bot initiatives and using goto (see the next section on Jumping in narrative) to navigate between them.
#
Jumping in narrativeThe bot initiatives in your narrative will execute in order, but you can use goto parameter to jump to any other bot initiative in the narrative, or in another narrative.
Here is an example where goto is used to jump to a different part of the same narrative (talking about the weather) instead of going to the next bot turn in the narrative which would be a trivia game.
#
Conditional bot turnsConditions are an essential part in making your dialog customized for the user. In your narrative, it is common to sometimes skip bot initiatives if some criteria is met. One example could be a bot initiative asking a user what color they want for a shirt they are buying. You likely only want to ask this question if the user hasn't already said what color he/she prefers, and if he/she actually is interested in buying a shirt.
Read how to implement conditions on bot turns in Logic docs.
#
Bridge turnsThe third type of bot-turn (aside from reply and request) is a bridge turn which allows you to have a bot-turn immidiatelly following another bot-turn. There are many cases where this is preferred:
- When you want to separate a long message into several shorter messages. This is important specifically for graphical chats where you might want to divide a long message into several "message bubbles" and you can't or don't want to create individual bot-initiatives for them - for example if you are in a sub-dialog as shown here:
- When you want to branch (i.e go to a different part of your dialog) based on a variable:
- When you want to use conditionals depending on the outcome of a webhook call and when it is not enough to do conditional says - for example because you want to use a goto in one of the cases.