Gopalakrishnan Iyer
Gopalakrishnan Iyer

Reputation: 23

My custom intent is not invoked nor a JSON request / response is shown. Only the default intent works i believe

I am new to alexa. I created a custom intent to just repeat a custom text (no slots etc). However my custom intent is never invoked. saved and deployed my code. I get empty JSON request and response - meaning my intent is never invoked. I saved the code and deployed. Adding below the intent node js code handler.

// Begin Code added by Gopalakrishnan for Handling Check Workday Inbox

const checkInboxIntentHandler = {
canHandle(handlerInput) {
    return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
        && Alexa.getIntentName(handlerInput.requestEnvelope) === 'checkInbox';
},
handle(handlerInput) {
    const speakOutput = 'I am here to check Workday Inbox!';

    return handlerInput.responseBuilder
        .speak(speakOutput)
        //.reprompt('add a reprompt if you want to keep the session open for the user to respond')
        .getResponse();
}
};

/*End*/

Upvotes: 1

Views: 35

Answers (1)

Andrew-Harelson
Andrew-Harelson

Reputation: 1073

There is nothing wrong with the code provided here. Here are a couple of things I recommend checking:

  1. Check that your handler is added to the skill with the addRequestHandlers function in the skill builder. Typically this builder is at the bottom of your index.js file.
  2. Check that the intent name "checkInbox" is spelled the same in both your interaction model and canHandle method.
  3. Make sure that your interaction model with the added checkInbox intent has been built in the skills console.
  4. Make sure that you are launching your skill before trying to invoke this intent.

Upvotes: 1

Related Questions