Closed Kevintjeb closed 6 years ago
Hmmm, I'm not so sure... from: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs
this.emit(':tell',speechOutput); | Tell with speechOutput this.emit(':responseReady'); | Called after the response is built but before it is returned to the Alexa service. Calls : saveState. Can be overridden.
Also, are you using the version of the SDK that comes with Lamdba, or are you doing npm install and then uploading? Because, the version in Lambda is VERY old and very different to the current code, and probably won't behave as you hope/expect.
But either way, try the responseReady method instead and see if that works..
Thanks for responding,
const Alexa = require('alexa-sdk');
const handlers = {
'LaunchRequest': function() {
this.response.speak(welcomeOutput).listen(welcomeReprompt);
this.emit(':responseReady');
},
'OrderIntent': function() {
if (this.event.request.dialogState !== "COMPLETED") {
this.emit(":delegate");
} else {
let intent = this.event.request.intent;
if (intent.confirmationStatus === "DENIED") {
let speechOutput = `response`;
this.response.speak(speechOutput);
this.emit(":responseReady");
} else if (intent.confirmationStatus === "CONFIRMED") {
let speechOutput = "response";
this.response.speak(speechOutput);
this.emit(":responseReady");
}
}
}
};
exports.handler = (event, context) => {
let alexa = Alexa.handler(event, context);
alexa.appId = APP_ID;
alexa.registerHandlers(handlers);
alexa.execute();
};
This code still does the same, after ''response" it waits till it times out to stop the session.
I was using the standard lambda alexa-sdk, now I downloaded the latest version using NPM and uploaded that.
@Kevintjeb , The shouldEndSession property in echo show and echo dot has different behavior, Because in echo show, the display times out might be happened before the session times out. Check this issue for more information.
Okay, from the other Issue I can't find out how to properly exit the skill upon completion. Therefore my question remains, how can I stop the skill/session programmatically/ in Lambda?
I think the only way is to use user utterance like 'Alexa, stop', 'Alexa exit' to trigger the shouldEndSession to be true. Otherwise, the session will remains open until the display times out.
Hi,
I am using the SDK to define my Alexa Skill.
(Removed specific details)
Using this code my echo Show stays in the session until it times out (8 seconds) then it returns to the homescreen. However, the documentation (And code, I looked at the implementation) specify that using this.emit(":tell") should set the 'shouldEndSession' flag to true, which in turn ends the session.
Unfortunately this is not happening.