Closed nikolasleblanc closed 5 years ago
Maybe ask this on an Alexa forum? (add link)
It can definitely be done, just wondering if it was part of the alexa-app api, see https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs:
var handlers = {
'LaunchRequest': function () {
this.emit('HelloWorldIntent');
},
'HelloWorldIntent': function () {
this.emit(':tell', 'Hello World!');
}
};
@nikolasleblanc Would welcome a new feature that does it!
Cool @dblock. I'm pretty new to this, but really enjoying it. Will see what I can do!
You can create a function that is used by both the initial intent and the launch intent. I think that it would currently be very difficult to write code that would trigger a handler (launch or otherwise) from another handler.
app.launch((req, res) => {
// do launch things
return initialBehavior(req, res);
});
app.intent("HelloWorldIntent", (req, res) => {
return initialBehavior(req, res);
});
function initialBehavior(req, res) {
// do things you would do for both here
}
I like the idea of being able to trigger other handlers from within a handler (launch as well as other intents). I'll try to hack on this when I get a chance to.
Resolved via #374
If at the conclusion of an intent I would like to return to the initial intent, how would I do that?