This article will show you how to capture data from your users and how to use that data to create more engaging skills.


When an intent is set to be triggered "By what the user says" on the Activation tab,  the user can say things similar to the examples you enter into the "The use can say things like.." box.

"Slots" are how you capture data in Voice Apps.   You create a slot by entering something like "{slotName}" in the "User can say things like..." box.

Let's say you want to capture the user's favorite NFL team.  Alexa asks the user "What's your favorite NFL team?".   To capture the answer, you would setup "The user might say things like..." box like this:

To capture the "team" part of all of these phrases, we would change the samples like this:

Slot Values

Now that we've added the "team" slot to our sample phrases, we need to tell the system what values we expect for the slot.   When you add your first slot, Voice Apps automatically creates a Slots box underneath our samples where we can configure the settings for our slots.

You can choose from dozens of different slot types which have pre-selected values.  To see a full list of these slot types, click here.

You can also create a "custom" slot and enter your own values.  Slot values tell Alexa what values you expect the user to say.

It's important to note, that if the user says something that's not in the slot values list, Alexa may still send that value to your skill.  You need to make sure you're skill handles that case gracefully.

So, let's enter our team names in the slot values list for our "team" slot:

Now, when the user says "my favorite team is the Jacksonville Jaguars", Voice Apps will create a variable called "team" and assign the value "Jacksonville Jaguars" to it. 

Variables are just a way to store information and retrieve it later.

Using a Variable

Now that we've captured the user's favorite team, we can use it later in our skill.  We can use it in a response back to the user.  We can use it to give different responses based on the value of the "team" variable.  We can use it to call out to an external API to get additional information and provide that to the user.  The possibilities are endless.

Here's an example of how you would use it in a response back to the user:


So, we captured the user's team and are able to use it to do some pretty cool things.  But there's an issue.  What happen's if the user says "My favorite team is the bears"?  "bears" is a common way to say "Chicago Bears".  The user might also say "I like Chicago".  Now, any logic we have based on the "team" variable or any responses we give to the user will not be what we intended.  We were expecting the "team" variable to have the full name "Chicago Bears" not "bears" or "Chicago".

Synonyms to the rescue.  We can add these other words (or phrases) that mean the same as "Chicago Bears" into our slot values and then regardless of which version the user says, our skill will always get the "canonical" version, "Chicago Bears". 

You just add the synonyms by adding a comma between values.  The first value will be the "canonical" value and is what will be returned by Voice Apps when any of the values are spoken by the user.

Now, when our user says "My favorite team is the bears", Voice Apps will create the "team" variable, but this time it will have two values.  "team.value" will contain our team name "Chicago Bears".  Remember, the first value is the "canonical" value and is the value returned whenever any of the synonyms are matched.

The second value, "" contains an optional identifier that you can specify using the "canonical:id" format.  If you don't specify a value for "id", then the "" variable will be the same as "team.value".  Here, we've specified "1" as the id for the Jacksonville Jaguars, "2" for the New England Patriots, and "3" for the Chicago Bears:

So, now if the user says their favorite team is the "bears", the "team.value" variable will contain "Chicago Bears" and "" will be set to "3".   This is really useful when you want to use the "" value to do branching logic or for passing the id to an external API (Application Programming Interface) to retrieve additional data or to store information.


Capturing data from the user can make your skills more useful and engaging.  Voice Apps makes it really easy to capture this data and use it in other parts of your skill. 

We can't wait to see what you'll build with this cool feature!


Did this answer your question?