Enable Confirmation For A Slot In An Alexa Skill Dialog Model

Introduction

 
In this article, I am going to demonstrate how to define slots and how to define prompts for slot confirmation and confirming slot values using user utterances such as yes or no, which are one of the components required to create a dialog model for an Alexa skill. Dialog models are created to simplify Alexa skills code to collect and confirm slot values. The dialog model identifies the prompts and utterances to collect, validate, and confirm the slot values and intents.
 

Components of a dialog model

 
There are four components to the dialog model.
 
Required slots and prompts
 
A required slot represents information that your skill must have in order to fulfil the user's request. For instance, the RegisterBirthday intent requires, at a minimum, the day (day), month (month), and year (year) to save birthday details for future. You can control the order in which Alexa asks for the slot values.
 
Slot confirmation prompts
 
You can optionally designate a required slot as requiring confirmation. This means that the user must also confirm the slot value with a yes/no response before proceeding.
 
Intent confirmation prompts
 
You can specify that the entire intent requires confirmation. This is common for skills that order products or make reservations. A confirmation prompt typically repeats back to the user all the information previously provided for the user to confirm.
 
Slot validation rules and prompts
 
You can configure a set of validation rules that the slot value provided by the user must pass to be considered valid. If the value fails validation, Alexa can use your prompts to ask for a corrected value. You can use slot validation rules with both required and non-required slots.
 

Creating Custom Alexa Skill

 
A custom Alexa skill named birthday time has been created. The skill contains an intent name RegisterBirthday intent having day, month and year as different types of slot values.
 
 
 
Different slot types of RegisterBirthday intent
 
 
 

Enable confirmation for a slot

 
If a slot is required then a skill must get a valid value for it before user's request can be completed. If a slot requires confirmation, your skill needs to ask the user to confirm the slot value with "yes" or "no". Define a set of prompts to get this confirmation from the user.
 
 Section  Description  Examples
 Alexa Speech Prompt
Questions that Alexa speaks to ask the user to confirm the slot value.
 
The prompts should be specific to confirming just this one slot.
 
The prompts should be worded such that the user can respond with "yes" or "no".
 
If you provide more than one prompt, Alexa chooses one at random. This gives Alexa a more conversational, human style.
 
Include the slot name in the prompt in curly brackets ({ }). When speaking the prompt, Alexa replaces this token with the value the user previously provided. 
For the day slot, you could have confirmation prompts like this:
 
You said your birthday is on {day}, right?
 
I heard you said {day}, am I right?
 
You said you're having your birthday on {day}, right?
 
Please verify that your birthday is on {day} 
 
The above examples would support a conversation like this for the day slot,
 
User: remember my birthday
Birthday time: which day is your birthday?
User: 19
 
Birthday time: You said your birthday is on 19, right?
User: Yes
 
Alexa Speech Prompts
 
 
 
To enable confirmation for a required slot,
 
  • In the left-hand navigation, find the intent and its list of slots, then click the slot name.
  • Under Slot Confirmation, enable the Does this slot require confirmation? Option.
  • Fill in the Alexa Speech Prompt section with your prompts.
 
Json code for creating required Alexa speech prompts and user utterances for slot confirmation is as follows,
  1. "prompts": [  
  2.               
  3.             {  
  4.                 "id""Confirm.Slot.1170703155793.1169631125804",  
  5.                 "variations": [  
  6.                     {  
  7.                         "type""PlainText",  
  8.                         "value""Please verify that your birthday is on {day}"  
  9.                     },  
  10.                       
  11.                     {  
  12.                         "type""PlainText",  
  13.                         "value""I heard you said {day}, am I right?"  
  14.                     },  
  15.                     {  
  16.                         "type""PlainText",  
  17.                         "value""You said your birthday is on {day}, right?"  
  18.                     },  
  19.                     {  
  20.                         "type""PlainText",  
  21.                         "value""You said you're birthday is on {day} , right?"  
  22.                     }  
  23.                 ]  
  24.             },  
  25.             {  
  26.                 "id""Confirm.Slot.1170703155793.1289925100546",  
  27.                 "variations": [  
  28.                     {  
  29.                         "type""PlainText",  
  30.                         "value""You said your birthday is in {month} , right?"  
  31.                     },  
  32.                     {  
  33.                         "type""PlainText",  
  34.                         "value""I heard you said {month} , am I right?"  
  35.                     },  
  36.                       
  37.                     {  
  38.                         "type""PlainText",  
  39.                         "value""Please verify that your birthday is in {month} ."  
  40.                     }  
  41.                 ]  
  42.             },  
  43.             {  
  44.                 "id""Confirm.Slot.1170703155793.576520739409",  
  45.                 "variations": [  
  46.                     {  
  47.                         "type""PlainText",  
  48.                         "value""Please verify that your birthday is in {year} "  
  49.                     },  
  50.                       
  51.                     {  
  52.                         "type""PlainText",  
  53.                         "value""I heard you said {year} , am I right?"  
  54.                     },  
  55.                     {  
  56.                         "type""PlainText",  
  57.                         "value""You said your birthday is in {year} , right?"  
  58.                     }  
  59.                 ]  
  60.             }  
  61.         ]  
Output
 
 
As we can see from the output, Alexa prompts “You said your birthday is on 16, right?” To confirm the day slot value of RegisterBirthday intent as provided by user.
 

Summary

 
In this article I have demonstrated how to define slots and how to define prompts for slot confirmation and confirming slot values using user utterances such as yes or no, which are one of the components required to create a dialog model for an Alexa skill. I have also explained one of the components of dialog model. Proper examples of Alexa speech prompts and user utterances are provided along with a json code snippet of interaction model.