Steps
BotTalk describes the dialog flow between the user and the assistant as a set of steps that are connected with each other using next
sections of each step.
Consider the following example:
scenario:
steps:
- name: Welcome Step
actions:
- sendText: >
Hello and welcome to my new skill.
Do you want to continue with the game we started last time or start over?
- getInput:
next:
continue_with_the_game: Continue
start_over: Start New Game
- name: Continue
actions:
- sendText: >
OK, let's continue with the game. Last time you played you had 23 points...
The next question: What is the highest building in New York City?
- getInput:
next:
highest_building_answer: Check Highest Buidling Answer
- name: Start New Game
actions:
- sendText: >
Great, let's start a new game!
I'll ask you some questions - and you will answer them.
Are you ready?
- getInput:
next:
yes_sure: Ready
not_yet: Wait
This scenario describes a prototypical trivia game that the user has already played before.
In the Welcome Step
the assistant asks the user if she wants to continue with the game or start over. To send a text from assistant to a user BotTak uses sendText
action. The assistant is then waiting for the user to answer - this is represented by the getInput
action.
There are two possible answers to this questions. We call those answers intents.
What happens NEXT when either of those answers is given is described in the next
section of the step.
In our prototypical game the first intent is called continue_with_the_game
and when the user says something like “Yes, sure, let’s continue” BotTalk jumps to the Continue
step.
When the user says something along the lines of "Start the new game"
, BotTalk will jump to the step Start New Game
.
Basic rules
Each step should have a unique name. First step, described in this section, becomes initial step - meaning it will be executed when the Alexa Skill / Google Action is invoked.
next
section of a step is not obligatory. You can choose to jump to the next step directly without waiting for a user input like that:
- name: Step One
actions: "I am the first step"
next: Step Two
- name: Step Two
actions: "I am the second step"
In this example above, Step Two
will execute right after Step One
. All text responses, produced by the steps, will be concatenated into one big response.