alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

Continue session after SessionEndedRequest #138

Closed adrianhara closed 7 years ago

adrianhara commented 7 years ago

I'm trying to continue the session in case SessionEndedRequest is called with a reason of EXCEEDED_MAX_PROMPTS like so

'SessionEndedRequest': function () {
        let request = <IntentRequestEx>this.event.request;
        if (request.reason === 'EXCEEDED_MAX_REPROMPTS') {
            console.log(`Trying to continue session...`);
            this.emit(':ask', 'I am sorry, I did not understand that.');
        }
    },

The Trying to continue message is logged, but there is no follow-up after that, it looks like it has no effect. If I understand correctly from the docs, :ask should keep the sesion open.

I also tried:

 this.response.speak('let us try again').listen('or whatever');
 this.emit(':responseReady');

...which according to the docs (https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs) should as well set shouldEndSession to false. Still, my session doesn't continue.

Am I doing it wrong? If so, how can I continue the session in case the EXCEEDED_MAX_PROMPTS happens?

odintsovamz commented 7 years ago

@adrianhara Adrian, SessionEndedRequest is a one-way notification to your skill that session has ended for some reason. Alexa cloud services will ignore any directives sent in response to SessionEndedRequest. Could you help me understand what documentation or sample suggested that Alexa would allow to resurrect a session in this manner so we could clarify the use case? My email is in my profile if you decide to reach out directly.