“You just triggered MyCoolIntent”

If you’re testing your new skill on the Alexa Developer Console (the Test tab) and you run into an odd message similar to ”You just triggered MyCoolIntent”, there is an easy solution to your problem: add your intent to the request handlers to the addRequestHandlers method of the Alexa SkillBuilder.

const MyCoolIntent = {
    canHandle(handlerInput) {
        return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' && Alexa.getIntentName(handlerInput.requestEnvelope) === 'MyCoolIntent';
    },
    handle(handlerInput) {
        // do something cool!
    }
};

// ... other intents provided in the 
exports.handler = Alexa.SkillBuilders.custom()
    .addRequestHandlers(
        LaunchRequestHandler,
        // Something is missing here...
        // you should add MyCoolIntent here
        CancelAndStopIntentHandler,
        SessionEndedRequestHandler,
        IntentReflectorHandler
    )
    .addErrorHandlers(
        ErrorHandler
    )
    .lambda();

What is happening is that Alexa is searching for registered code intents to handle a user’s response and cannot find anything to handle it. The starter custom project includes a IntentReflectorHandler that is our fallback if we forget to set up our intents correctly:

// The intent reflector is used for interaction model testing and debugging.
// It will simply repeat the intent the user said. You can create custom handlers
// for your intents by defining them above, then also adding them to the request
// handler chain below.
const IntentReflectorHandler = {
    canHandle(handlerInput) {
        return handlerInput.requestEnvelope.request.type === 'IntentRequest';
    },
    handle(handlerInput) {
        const intentName = handlerInput.requestEnvelope.request.intent.name;
        const speechText = `You just triggered ${intentName}`;

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

If that doesn’t fix your problem, you should also check the canHandle method of the custom intent you have created.  Maybe you forget to change the Intent’s name in the canHandle() method?

const MyCoolIntent = {
    canHandle(handlerInput) {
        return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' && Alexa.getIntentName(handlerInput.requestEnvelope) === 'MyCoolIntent';  // make sure 'MyCoolIntent' is set here
    },
// ...
};

The default project that the Alexa Developer Console provides is a very capable starting point.  In fact, it does so much for us that we often forget the multiple steps that are required when registering custom request handlers and intents.

Amazon’s Alexa team is doing a lot to promote the platform for third-party developers, which leads many low-effort skills on the marketplace. Skill Certification is the bare minimum, but it shouldn’t be the standard.  Make sure that you understand the Alexa lifecycle and how to correctly configure and code an intent handler. Your users will thanks you for it.

For more information, check out this page from the official Alexa forum. Learn more about the Alexa SkillBuilder here: https://developer.amazon.com/fr/blogs/alexa/post/a47f25e9-3e87-4afd-b632-ff3b86febcd4/skill-builder-objects-to-customize-or-not-to-customize