0

I have multiple custom skill intents. I want to handle cancel the event for all custom intents. How can I get that which cancel is getting called.

const Alexa = require('alexa-sdk');
exports.handler = (event, context) => {
  const alexa = Alexa.handler(event, context);
  var APP_ID = "amzn1.ask.skill.[ssdad-5c61-4d4e-b2bf-7eea8a491816]";
  alexa.APP_ID = APP_ID;
  alexa.registerHandlers(handlers);
  alexa.execute();
};
const handlers = {
  'ConfirmChangeEvent': function() {
    this.emit(':ask', "Do u want commit for change? ");
  },
  'ConfirmLastAction': function() {
    this.emit(':ask', "Do u want confirm for last Action?");
  },

  'LaunchRequest': function() {
    this.emit(':tell', "Hi Damodar, I'm Dialogue manager");
  },
  'Amazon.CancelIntent' : function() {
    // i want handle cancel on both intents here  ConfirmLastAction and Conf irmChangeEvent

    //if ConfirmChangeEvent  should give output like "Okay cancelling changeEvent "

    // ConfirmChangeEvent  should give output like "Okay cancelling the Last Action " 

  }

  'Unhandled': function() {
    this.emit(':tell', "I'm not able to respond at this time");
  }
};

How can we handle this in node JS Alexa

1 Answers1

0

You need to use state management. Here is a link to the docs https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs#making-skill-state-management-simpler

By using state handlers you could have a different cancel response based on the user's current state.

Steve Tingiris
  • 331
  • 1
  • 5
  • Thank you very much @Steve Tingiris –  Nov 09 '17 at 03:52
  • https://stackoverflow.com/questions/47194136/alexa-not-responding-for-when-i-created-skill-from-skill-buidler –  Nov 09 '17 at 06:17