Wrapping Up

Slots provide a way for Alexa skills to interpret what a user says as parameterized requests. The slot values are extracted from the utterance and provided in the request given to an intent handler.

Each slot has a name and a type. Amazon provides several dozen built-in types to cover many common cases, including dates and times, numbers, city names, movie titles, colors, foods, and sports—to name a few. You can also define your own custom types to cover situations not handled by Amazon’s built-in types (such as planets).

When defining a custom slot type, it’s also possible to define synonyms for the slot’s values. This allows the user to use familiar or alternate terms for slot values in their requests, while Alexa is still able to map those terms to a canonical value for the purposes of handling the intent.

Capturing user input as parameters using slots works well when the user specifies valid and complete information. But when the user leaves out required details (such as a trip’s starting date) or provides invalid information (such as a destination not offered), then Alexa will need to ask the user to provide more valid details. In the next chapter, we’ll see how to define multi-turn dialogs that enable Alexa to elicit information that the user may have omitted, validate the slot values they give, and ask for confirmation before proceeding.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset