Say my custom skill is named Portal Entry. Here's what I need to do:
User: "Alexa, open Portal Entry"
Alexa: "Ok, would you like to perform task ABC or do XYZ?"
User: "Perform task ABC"
Alexa: "Ok, performing task ABC"
[...] executes function (couple of HTTP requests) [...]
when done:
- Alexa: "Task ABC was performed successfully"
If in 3 user said "do XYC", it should say "Ok, doing XYZ", execute a different function, and when done say "XYZ is complete. Pretty simple, right?
So (4) is just a confirmation, like "Ok, got you, I'm gonna do what you asked me". To make alexa jump from Intent 4 to intent 5 without having the user say something, I found out I should use Chaining Intents (as a way to trigger intent 5 automatically after intent 4 is resolved). I've followed amazon's tutorial on Chaining Intents and added the following to IntentFour
handle(handlerInput) {
const speakOutput = 'Ok, performing Task ABC!';
return handlerInput.responseBuilder
.addDelegateDirective({
name: 'IntentFive',
confirmationStatus: 'NONE',
slots: {}
})
.speak(speakOutput)
.getResponse();
}
In my IntentFive I have this:
handle(handlerInput) {
// executeFunction();
const speakOutput = 'Task ABC was performed successfully';
return handlerInput.responseBuilder
.speak(speakOutput)
.getResponse();
}
So as it is now, it should say 'Ok, performing Task ABC' and then say 'Task ABC was performed successfully.
Problem: it just jumps to IntentFive without saying what it's supposed to on IntentFour. So when I say 'Perform task abc' it says 'Task ABC was performed successfully'.
What am I missing? What's wrong with implementation described? Is there a better way to do that?
note: don't know if it's important but as amazon's tutorial recommended in order to have a dialog model "If you have at least one intent with a required slot, or you’ve enabled auto delegation, your skill has a dialog model", so I added a FooIntent with a required slot just to make it work, but I'm not using it at all.