Handling Multi-Value Slots

Up to this point, the slots we’ve defined only accept a single value per slot: one destination, one departure date, and one return date. But sometimes you need to collect a list of values in a slot rather than a single slot value. For instance, if you were building a skill for ordering pizza, you might want the user to name several toppings to be used when making a pizza.

With a small tweak to a slot definition, we can specify that a slot is able to accept a list of values. To illustrate how this works, suppose that we want to add an intent to the Star Port 75 skill that lets a user state their favorite planets. Such an intent might be declared in the interaction model like this:

 {
 "name"​: ​"FavoritePlanetsIntent" ...

Get Build Talking Apps for Alexa now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.