Patrick W. McMahon
Patrick W. McMahon

Reputation: 3561

Alexa skill have user confirm slot values

I'm building Alexa skills using Node.js in a lambda function and can't find any tutorials on the best way to confirm the data I have in the slots. I got to the point that all slots now have data but would like to have Alexa read back the request and get a confirmation from the user before proceeding. What's the best & proper way to do this?

At first I thought to use an emit with :elicitSlot but then I would need a new slot to do this and it looks very hackish.

for example:

if(all slots have a valid value){
this.emit(':elicitSlot','confirm',"You're request is .... with data .... is this correct?");
}
if(user confirmed data is valid){
// do something
}else{
// the data was not correct get the right data
}

Upvotes: 0

Views: 2648

Answers (1)

Sidmeister
Sidmeister

Reputation: 856

For the whole intent confirmation, check here. For only slot confirmation, check here.

Also, for your followup question,

can the confirmation for the skill and slots be fine tuned for example if one of the slots is something like a name and alexa knows 100% what name I said can it skip the confirmation?

Short answer - of course you can if you do not maintain the dialog. However, it's strongly discouraged to rely on that.

In order to maintain a dialog, you have to monitor dialogState attribute of the intent request, and as long as it's not in state COMPLETED send response with attribute directives as [{'type': 'Dialog.Delegate'}] to keep it flowing. You can maintain finer control of the dialog - consult this doc. Moreover, you are strongly suggested to omit outputSpeech and reprompt in those responses, otherwise Alexa gets upset. Once dialog status is COMPLETED, you get confirmationStatus (for both Intent and slots) - SUCCESS(?)/DENIED/NONE. If the confirmation is not successful. I have seen multiple matches being sent as reply. However, when successful, only the matched slot value is returned.

P.S. I have had this weird issue. When Alexa is asking for confirmation for one slot value, if I deliberately decline twice in a row, it gives up and does nothing! Although, pretty much 99% of the time Alexa was spot on.

P.P.S. Turns out 2 attempts was a hard limitation from Alexa. This is supposed to be improved in next iterations.

Upvotes: 3

Related Questions