Enable Confirmation For An Intent 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 intent confirmation and confirming all slot values of an intent 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 fulfill 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 the 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 a Custom Alexa Skill

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

Enable confirmation for an intent

 
If the entire intent requires confirmation, your skill needs to ask the user to confirm the action the intent will take 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 entire intent.
 
The prompts should be specific to confirming the entire intent. The prompt should include all the slot values mentioned in that intent.
 
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 all the required slots in the prompt in curly brackets ({ }). When speaking the prompt, Alexa replaces these tokens with the slot values the user previously provided. 
For RegisterBirthday Intent, you could have confirmation prompts like this:
 
That's {month} {day} {year}, did I get that right?
 
Are you sure you want to register {month} {day} {year}?
 
I'm saving your Birthday as {month} {day} {year}, Is that OK?
 
Please confirm that you want to register your birthday as {month} {day} {year}. 
 
The above examples would support a conversation like this for the RegisterBirthday intent.
 
User: remember my birthday
 
Birthday time: which day is your birthday?
User: 16 April 1993
 
Birthday time: I'm saving your Birthday as {month} {day} {year}, Is that OK? (Confirmation prompt for the intent)
User: Yes
 
 
 
To enable confirmation for an intent:
  • Click an intent from the left-hand navigation to open the detail page for the intent. 
  • Under Intent confirmation, enable Does this intent require confirmation?.
  • Fill in the Alexa Speech Prompt for the intent.
Json code for creating required Alexa speech prompts and user utterances for intent confirmation is as follows:
  1. "prompts": [  
  2.             {  
  3.                 "id""Elicit.Slot.653974572406.1040382425372",  
  4.                 "variations": [  
  5.                       
  6.                     {  
  7.                         "type""PlainText",  
  8.                         "value""when is your birthday?"  
  9.                     },  
  10.                     {  
  11.                         "type""PlainText",  
  12.                         "value""ok in {year} , but which day?"  
  13.                     },  
  14.                     {  
  15.                         "type""PlainText",  
  16.                         "value""which day is your birthday?"  
  17.                     }  
  18.                 ]  
  19.             },  
  20.             {  
  21.                 "id""Elicit.Slot.282358190483.487594834711",  
  22.                 "variations": [  
  23.                       
  24.                     {  
  25.                         "type""PlainText",  
  26.                         "value""ok but in which month exactly?"  
  27.                     },  
  28.                     {  
  29.                         "type""PlainText",  
  30.                         "value""in which month is your birthday?"  
  31.                     },  
  32.                     {  
  33.                         "type""PlainText",  
  34.                         "value""ok, the day is {day}. but in which month?"  
  35.                     }  
  36.                 ]  
  37.             },  
  38.             {  
  39.                 "id""Slot.Validation.190694681136.1424851421300",  
  40.                 "variations": [  
  41.                     {  
  42.                         "type""PlainText",  
  43.                         "value""Please say a valid day"  
  44.                     }  
  45.                 ]  
  46.             },  
  47.             {  
  48.                 "id""Slot.Validation.190694681136.463018349705",  
  49.                 "variations": [  
  50.                     {  
  51.                         "type""PlainText",  
  52.                         "value""Please try again and say a valid month"  
  53.                     }  
  54.                 ]  
  55.             },  
  56.             {  
  57.                 "id""Elicit.Slot.1253554922892.1358447173887",  
  58.                 "variations": [  
  59.                     {  
  60.                         "type""PlainText",  
  61.                         "value""you're from {month} of which year?"  
  62.                     },  
  63.                     {  
  64.                         "type""PlainText",  
  65.                         "value""ok. {month} {day}. but in which year?"  
  66.                     },  
  67.                     {  
  68.                         "type""PlainText",  
  69.                         "value""please now tell me in which year you were born"  
  70.                     },  
  71.                     {  
  72.                         "type""PlainText",  
  73.                         "value""which year were you born?"  
  74.                     }  
  75.                 ]  
  76.             },  
  77.             {  
  78.                 "id""Slot.Validation.1253554922892.1358447173887",  
  79.                 "variations": [  
  80.                     {  
  81.                         "type""PlainText",  
  82.                         "value""That's too old to be true. Please try again"  
  83.                     }  
  84.                 ]  
  85.             },  
  86.             {  
  87.                 "id""Slot.Validation.1253554922892.1358447173887",  
  88.                 "variations": [  
  89.                     {  
  90.                         "type""PlainText",  
  91.                         "value""That's too young to be true. Plese try again"  
  92.                     }  
  93.                 ]  
  94.             },  
  95.             {  
  96.                 "id""Confirm.Intent.746177723927",  
  97.                 "variations": [  
  98.                     {  
  99.                         "type""PlainText",  
  100.                         "value": "Please confirm that you want to register your   
  101.                                       birthday as {month} {day} {year} ."  
  102.                     },  
  103.                     {  
  104.                         "type""PlainText",  
  105.                         "value": "I'm saving your Birthday as {month} {day} {year},   
  106.                                       Is that OK?"  
  107.                     },  
  108.                     {  
  109.                         "type""PlainText",  
  110.                         "value": "That's {month} {day} {year} , did I get that   
  111.                                       right?"  
  112.                     },  
  113.                     {  
  114.                         "type""PlainText",  
  115.                         "value": "Are you sure you want to register {month} {day}   
  116.                                      {year} ?"  
  117.                     }  
  118.                 ]  
  119.             },  
  120.             {  
  121.                 "id""Confirm.Slot.1170703155793.1169631125804",  
  122.                 "variations": [  
  123.                     {  
  124.                         "type""PlainText",  
  125.                         "value""Please verify that your birthday is on {day}"  
  126.                     },  
  127.                     {  
  128.                         "type""PlainText",  
  129.                         "value": "You said you're having your birthday on {day},   
  130.                                       right?"  
  131.                     },  
  132.                     {  
  133.                         "type""PlainText",  
  134.                         "value""I heard you said {day}, am I right?"  
  135.                     },  
  136.                     {  
  137.                         "type""PlainText",  
  138.                         "value""You said your birthday is on {day}, right?"  
  139.                     },  
  140.                     {  
  141.                         "type""PlainText",  
  142.                         "value""You said you're birthday is on {day} , right?"  
  143.                     }  
  144.                 ]  
  145.             },  
  146.             {  
  147.                 "id""Confirm.Slot.1170703155793.1289925100546",  
  148.                 "variations": [  
  149.                     {  
  150.                         "type""PlainText",  
  151.                         "value""You said your birthday is in {month} , right?"  
  152.                     },  
  153.                     {  
  154.                         "type""PlainText",  
  155.                         "value""I heard you said {month} , am I right?"  
  156.                     },  
  157.                     {  
  158.                         "type""PlainText",  
  159.                         "value": "You said you're having your birthday in {month} ,   
  160.                                       right?"  
  161.                     },  
  162.                     {  
  163.                         "type""PlainText",  
  164.                         "value""Please verify that your birthday is in {month} ."  
  165.                     }  
  166.                 ]  
  167.             },  
  168.             {  
  169.                 "id""Confirm.Slot.1170703155793.576520739409",  
  170.                 "variations": [  
  171.                     {  
  172.                         "type""PlainText",  
  173.                         "value""Please verify that your birthday is in {year} "  
  174.                     },  
  175.                       
  176.                     {  
  177.                         "type""PlainText",  
  178.                         "value""I heard you said {year} , am I right?"  
  179.                     },  
  180.                     {  
  181.                         "type""PlainText",  
  182.                         "value""You said your birthday is in {year} , right?"  
  183.                     }  
  184.                 ]  
  185.             }  
  186.         ]  
Output
 
 
As we can see from the output, Alexa prompts “Are you sure you want to register April 16 1993”?, To confirm all the slot values of RegisterBirthday intent as provided by user.
 

Summary

 
In this article, I have demonstrated how to define slots and how to define prompts for intent confirmation and confirming all slot values of an intent 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 the JSON code snippet of the interaction model.