We can use the Interaction block whenever we need to give the user a set of choices and the choice block can not fulfill our needs. The interaction block lets us capture information from what the user says.
To get started, we should put together a set of choices for our interaction block. In the following example, we use a pizza store.
We will give the user 3 choices: pepperoni, veggie and deluxe.
Now that we have these intents defined, we can put them into our choices.
When we head into our choices, we have a long list of intents that we can select. Most of them are default intents made by Amazon and Google which have been set up to capture things that you say. We created several custom intents and so we need to choose those instead. Luckily, they are always at the top of our list.
Once we have our 3 choices set up, it should look like the above.
To make it easier to understand what a user is saying, it's important to give multiple example phrases.
Users can say a wide variety of things and so it is always best practice to use as many example phrases as possible to ensure that our skills and actions work the way that they should.
At this point, we have a basic set of intents and 3 choices that the user can use. This could have been done quite easily (and in less steps with the Choice block). Where the Interaction block becomes useful though, is being able to handle more complex choices and capturing parts of what the user is saying.
Let’s dive into slots to see this in action.
Below we have a new slot that was just created, at the moment it’s called slot_one and has no type.
I’m going to set a slot to capture the various sizes that the user may say. First I’m going to set the slot value to custom and rename our slot to “size”.
Instead of adding “I want a large deluxe pizza”, “I want a medium deluxe pizza” and “I want a small deluxe pizza”, I can replace all references to size with the [size] slot. This lets us both save time when building out our intents as well as capture what the user said.
In the above screenshot, we add the slot into the example phrase so that we can capture what the user says accurately.
Now that we have this slot to capture the information we want, let's save it to a variable inside Voiceflow so that we can use it throughout the project.
A “Slot Mapping” section will have popped up on our Choices screen. This is where we can capture what our users are saying and save them to a variable.
Above, I have declared a variable called “SizeVariable” so that it is easy to differentiate from our “size” slot.
Now we can set SizeVariable to take in any information from the size slot that the user says.
In the above example, we can see that our slot is being captured, stored and reused through the variable that we set up.
If we try another input, we can see it being captured in the slot as well:
This was meant to be a short tutorial for how to use the interaction block, to learn more about how intents, slots and utterances work, you can check out the following links: