I want to create a simple multi-turn dialog with the Alexa Skill model. My intent consists of 3 slots, each of which are required to fulfill the intent. I prompt every slot and defined all of the needed utterances.
Now I want to handle the request with a Lambda function. This is my function for this specific Intent:
function getData(intentRequest, session, callback) {
if (intentRequest.dialogState != "COMPLETED"){
// return a Dialog.Delegate directive with no updatedIntent property.
} else {
// do my thing
}
}
So how would I go on to build my response with the Dialog.Delegate
directive, as mentioned in the Alexa documentation?
https://developer.amazon.com/docs/custom-skills/dialog-interface-reference.html#scenario-delegate
Thank you in advance.
In nodeJS we can check the dialogState and act accordingly.
With
Dialog.Delegate
directive you cannot sendoutputSpeech
orreprompt
from your code. Instead those defined in interaction model will be used.What this means is that you cannot
delegate
and provide your own response, but instead you can use any otherDialog
directive to provide youroutputSpeech
andreprompt
.Ex:
Dialog.ElicitSlot
,Dialog.ConfirmSlot
andDialog.ConfirmIntent
.At any point, you can take over the dialog rather than continuing to delegate to Alexa.
The
updatedIntent
parameter inaddDelegateDirective()
is optional. It is an intent object representing the intent sent to your skill. You can use this property set or change slot values and confirmation status if necessary.More on Dialog directives here
In nodejs you can use