Last updated March 14, 2019

Interaction block.

What you'll learn

  • What intents and slots are
  • How to use the interaction block, and when
  • How to pick specific parts out of a user's sentence

Video tutorial

Interaction block overview
The interaction block uses Amazon's Intent & Slot system to pick apart user sentences and store particular parts (called 'Slots') into variables. For example, you can ask a user to describe their favorite activity in their favorite city, and their name:

I love [biking] in [Seattle], and my name is [Sarah]

Above, the bolded sections are 'Slots'. They are sections we've highlighted for Alexa to look out for. We told Alexa to watch for an Activity Slot, followed by a City Slot, and a Name Slot.

Using these slots, we can then store multiple sections of the user's response into variables.

There are three sections to the Interaction block: 

  • Slots: Choose what information Alexa is looking for in each intent
  • Intents: Choose what slots will be used in each intent
  • Choices: Choose what happens when each intent is activated

To switch between the different sections of the intent block, you can select the Active Section by clicking on the corresponding button.

Slots and intents are globally available across the project, whereas choices are local to that specific interaction block. Meaning, that Slots and Intents created can be found across every Interaction block in the project, even if you delete the Interaction block they originated from.

Choices on the other hand are specific only to the Interaction block you are currently on.

SLOTS

Adding Slots

To add Slots, hit the 'Add Slots' button. You can create as many Slots for your project as you'd like. 

Renaming Slots

To rename a slot, click on the name of the slot. It will by default be named a slot number according to how many slots are in your project. Slots need to have lowercase letters and no spaces, so Voiceflow changes this and adds underscores for you.

Slot Types

Slot types are organized categories of data from Amazon. For example, the Slot Type for US CITIES has thousands of examples of US Cities within it. This becomes useful because it helps Alexa determine what the user said correctly. Without Slots, Alexa will listen to the user and try to guess the word. With Slots, Alexa will guess a word, then match that word across the thousands of examples in the Slot Type to find the right match. This allows Alexa to correctly pick City names which may not have regular names, as well as thousands of other more 'difficult' and specialized words. Numbers for example are another particularly useful Slot Type.

To choose a Slot type, click on the drop-down per-slot and choose a Slot Type. A Slot can only have one Slot Type. You can also define custom Slot Types which require you to manually enter all of the different Slot examples into the Slot Content Example.

Slot Content Examples

As mentioned above, Slot Content Examples allow you to add examples to your current Slot Type. For example, if you wanted to add fictional City names to the US.CITIES Slot Type, you could do so by adding them manually into the Slot Content Examples. This allows you to customize your Slot Types, or even create an entirely custom Slot Type by using the 'Custom' Slot Type, paired with Slot Content Examples for your new custom Slot Type.

INTENTS

What are Intents?

Intents are sentences that Alexa specifically looks for within an Interaction block, and each Intent sentence can hold Slots. There can be up to 250 intents within your project, and with Voiceflow your intents can be reused by multiple Intent blocks.

Amazon Intents

Amazon has hundreds of pre-made intents for you to use. To use a pre-made intent by Amazon, click on the 'Choices' tab within the Intent block, and create a new choice. 

To select an Amazon intent, click on 'Select Intent' within your newly created intent. 

From here, you have access to hundreds of intents you can use. For more information on each of the built-in intents by Amazon, you can research here.

Create custom intents

To create a custom intent in Voiceflow, you can do so within the Interaction block by hitting the 'Add Intent' button within the Intents tab.

Renaming Custom Intents

Similar to renaming slots, you can rename intents by clicking on the name of the intent. 

Using Custom Intents

Custom intents allow you to create your own intent. Essentially, it allows you to look for particular phrases or sentences the user may say. For example, you may want to create an intent for a user looking to check the weather.

We would want to call our intent the 'check_weather_intent' and within the intent, have examples for phrases the user may say to try and check the weather. We can add one phrase by entering it into 'Enter User Reply' within the intent.

Now if the user was to say something similar to 'check the weather', this intent would be activated.

Adding custom intent synonyms (also called 'utterances')

Intent synonyms are variations of what the user could say to activate a particular intent. For example, we could have 10-20 different variations of things the user could say to activate our 'check_weather_intent' intent.

To add synonyms, you can type in the 'enter synonyms' box and add as many as you'd like. For the best optimal use of your synonyms, be sure to keep them fairly related to the intent's intended topic.

Deleting custom intent synonyms

To delete custom intent synonyms, simply hit the 'x' marker to delete the synonym. 

Using Slots in your Intents

By using slots in intents, you can store a user's particular response in a variable for use. For example, in our 'check_weather_intent' we can have the user ask for the weather in a particular city and store their city response in a variable using a slot.

Let's do that.

To use a slot in an intent, we use the square bracket ' [ ' to open the menu of available slots. 

I've gone ahead and made a slot for US cities called [city].

In our intent responses, we want to use our new city intent in a couple different ways the user may respond to asking for the weather for a particular city.

Lastly, we will 'map' (store) the user's slot response into a variable in the 'choices' step.

CHOICES

Choices allow you to choose what happens after a user says a particular intent. For example, using a choice we can route our 'check_weather_intent' to go to an API block, or if the user says 'play_music' we can route the user to go to a Stream block. And, we can have both of these choices within one interaction block, or multiple interaction blocks. This gives us a lot of flexibility and power when building our skills.

Adding choices

When the interaction block has no choices added, it just has the 'else' route. 

Once you add an intent Choice, similar to a Choice, Random, or IF block, an additional port will be visually added.

To link a route with an intent, click 'select intent' and choose the intent you would like to link for that particular path from the drop-down menu. 

Here, you'll see there are both the built-in intents from Amazon, as well as the custom intents you have created, if you have created custom intents.

Mapping Slots to Variables

If the intent you've chosen has Slots, an option will pop-up to map the intent's Slots to a project Variable.

You may map multiple variables per intent. To map a variable, choose the slot you want the value to come from, and the variable you want the value to be stored in. We want the user to ask for the weather in a particular city, we are going to use a slot to capture the city they want, and we're going to store that [city] slot value in a variable called {city}.

Here, we can see that the [city] slot value will be transferred to the {city} variable.

If the intent you are using does not have slots, then you will not have the 'Slot mapping' option pop-up.

Still have questions? Be sure to post in our Forums to get fast answers!

Did this answer your question?