I am using ask-sdk version 2.3.0
const SessionEndedRequest = {
canHandle(handlerInput) {
const request = handlerInput.requestEnvelope.request;
return request.type === 'SessionEndedRequest'
},
handle(handlerInput) {
return handlerInput.responseBuilder.speak("Good bye").withShouldEndSession(true).getResponse();
}
};
const skillBuilder = Alexa.SkillBuilders.custom();
exports.handler = skillBuilder
.addRequestHandlers(
LaunchRequest,
SessionEndedRequest
)
.lambda();
SessionEndedRequest is the function which gets executed when the user says "Stop" or "Cancel"
The outut when user says "cancel"
{
"body": {
"version": "1.0",
"response": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>Good bye</speak>"
},
"shouldEndSession": true,
"type": "_DEFAULT_RESPONSE"
},
"sessionAttributes": {},
"userAgent": "ask-node/2.3.0 Node/v8.10.0"
}
}
and the alexa response is this
There was a problem with the requested skill's response