Hello guys welcome to the 28th session of create custom Alex's key using AWS lambda function tutorials for beginners. In this session we will learn how to use confirm intent directive. Confirm slot is used for confirming specific slot value. But what if you have three slots in intent? In that situation, it will prompt for three times you to this behavior user may feel irritating. We can use confirm intent directive or single confirmation crowd for all of these slots.
For this let us create a new intent with name food order intent. Here user will specify what they want to order. The user may say I would like to order order quantity Order Item. Audiences simply specifies order quantity Order Item. The Order Item slot will be the type of Amazon dot food order quantity will be numeric ruled out and animal intent confirmation. You will need to add tags for a prompt that will be displayed on intent confirmation.
Let us add I assure you want to buy order quantity Order Item. Open JSON editor. Here is an intent that we have created. Here is a dialog for it. You can see that configuration required is true for intent itself not for any slots. Scroll to end here is a drone that we have added with the model let us switch to Visual Studio Code Create a new handle for this intent.
The 74 foot intent request that is obtain intent from the envelope. Check confirmation status for intent. If it is confirmed ng generate a response with both values for this return value of both slots generate speech text you order for all quantity Order Item notate successfully and simply return this response. If it status is denied, can use Can you tell me again what you want as output space as well as probed and written this response. Now, when it status is none then we need to ask user for confirmation. Let us copy this line in which we have retrieved slot values.
Update message do you want to buy order quantity Order Item right Use ad confirm intent direct to method. Add this handler and request handlers to define declare lambda function. Let us taste it. Alexa, open the third demo Welcome to third demo skill. I would like to order to Italian pizza. You want to buy two Italian pizzas, right?
No. Can you tell me again what you want a margarita. You want to buy three Margarita? Right? Yeah you order for three Margarita noted successfully. Thank you.
Let us see what we have learned in this session. The confirm intent directive is used to confirm entire intent echoing confirmation status of intent contains status of intent. When it was confirmed then we will prompt the user with values when it was denied, then we have to ask for values again when it was done then we will return confirm slot from using ad confirm intend to write to matters. Also watching this video, if you have any doubts, please feel free to contact me Have a nice day.