Lately I have been playing around with Alexa trying to set up some simple conversations. One of the problems I had was that Alexa kept on closing down my session. Which resulted in my Alexa skill starting and then shutting down again after Alexa had spoken - she was not waiting for my reply. I could see in the JSON reply that shouldEndSession even was true! fyi - my examples are in nodejs.
How I solved it
I quickly realised that I had to set the variable shouldEndSession to false
. According to the docs this could be done in the following way in my handler:
this.response.shouldEndSession = false;
However the above did nothing for me. I googled a lot and found people saying that I should also add a this.response.listen();
line to my code. This did the trick. Below you can see the full code that I have used in nodejs:
'PlayIntent': function () {
this.response.speak('Welcome');
this.response.reprompt = {
outputSpeech: reprompt
};
this.response.shouldEndSession = false;
this.response.listen();
this.emit(':responseReady');
},
I hope this helps someone out there, let me know in the comments if it did :)