We’re excited to announce slot validation, a new Alexa Skills Kit (ASK) dialog management feature available for developers to use in all ASK locales. When you enable slot validation for dialogs that you delegate to Alexa, Alexa will check slot values collected against an acceptable set you define, and automatically re-prompt users who provide a response outside that set. As a result, you can eliminate validation and re-prompting code in your skill back end. This simplifies your development and results in a more consistent experience for customers.
Use Dialog Management to Manage Multi-Turn Conversations
Dialog management makes it easier for your skill to handle variations of conversation, conditional collection of data, and context switching, without losing track of what’s being said. Dialog management keeps track of the slots that you tell it to collect, and uses a state machine to manage the state of the conversation, including what information has and hasn’t been collected. You can either delegate the dialog to Alexa, using the Dialog.Delegate directive, or control each step of the dialog yourself, using Dialog.ElicitSlot, Dialog.ConfirmSlot, and Dialog.ConfirmIntent. You can learn more in the Alexa Skill Builder’s Guide: Advanced Skill Building with Dialog Management.
Let Alexa Validate Slots for You
The new slot validation feature is available for dialogs that you delegate to Alexa. With slot validation, you define rules that specify the acceptable values for a slot, along with specific prompts for eliciting a new value. You can set relative and absolute range validations for number and date/time slots, and enumerated lists of values to allow or exclude for list and custom slots. For custom slots, you can also allow only values specifically enumerated in your custom values and synonyms. When a user speaks a slot value that does not meet your validation criteria, the prompts you define will be used by ASK dialog management to ask for a new value.
For example, if your skill has a list of color options that includes “red,” “green,” and “blue,” you can configure slot validation to only accept these colors from the user. If a user tells your skill, “I want the color orange,” slot validation will reply with the prompt you provide for this rule, such as, “We only have red, green, and blue. Which of these would you like?” When the user replies with an acceptable color option, the dialog will proceed to the next step. If the user fails to provide a valid slot after two re-prompts, the skill session will end.
Learn More and Get Started Today
Slot validation is available in all locales supported by Alexa, and is available through the skill builder in the Alexa Developer Console and Skill Management API (SMAPI). To learn how to use slot validation in your skills, read the Building Conversational Alexa Skills: Validating Slots with Dialog Management blog and our Validate Slot Values documentation.
- Validate Slot Values
- How to Dynamically Elicit Slots Based on a Previous Answer Using Dialog Management
- Confirming Slots with Dialog Management
- Build Advanced Alexa Skills Using Dialog Management
- Guide: Advanced Skill Building with Dialog Management
Source: Alexa Developer Blog