0
votes

I am playing around with the Alexa SDK and I came across a strange behavior. I am trying to implement all possible ways a user could end a session. The problem I have is that the word "exit" returns Alexa saying "There was a problem..." and quits the skill immediately. All other words like "stop" or "cancel" work fine and return a goodbye message.

Here is how I implement the handlers:

'AMAZON.CancelIntent': function () {
    this.emit('SessionEndRequest');
},
'AMAZON.StopIntent': function () {
    this.emit('SessionEndRequest');
},
'SessionEndRequest': function() {
    const speech_output = 'Goodbye and take care!'

    this.emit(':tell', speech_output);
},

As you can see to keep this as simple as possible right now I redirect the StopIntent and CancelIntent to the SessionEndRequest which returns a goodbye message. This works great, except for "exit" which is not recognized.

Is there a way to implement this? I tried to use a custom intent (called ExitIntent) with the utterance "exit" plus a bunch of other ones like "see ya", "until next time" and all work well except for the "exit" utterance.

Or is there a way to handle an unrecognized utterance - ie. return the HelpIntent?

2

2 Answers

2
votes

If you want to handle an unrecognized utterance, simply create an Unhandled request.

'Unhandled': function () {
     const speech_output = 'Goodbye and take care!'
     this.emit(':tell', speech_output);
}

This should solve your issue of the 'exit' not working.

0
votes

I had the same issue. Simple fix, add "exit" as an utterance to the AMAZON.StopIntent