0

how can I perform multiple functions that refer to different APIs? Also I would like that when I call my skill, it started with the presentation. But I can't do that, why?

    exports.handler = (event, context) => {
    const alexa = Alexa.handler(event, context);
   const skillBuilder = alexa_info.SkillBuilders.custom();
     skillBuilder
    .addRequestHandlers(LaunchRequest,
    LaunchRequestHandler,
    GreetMeIntentHandler,
    EmailIntentHandler,
    MobileIntentHandler,
    HelpIntentHandler,
    CancelAndStopIntentHandler,
    SessionEndedRequestHandler
    )
    .addRequestInterceptors(RequestLog)
    .addResponseInterceptors(ResponseLog)
    .addErrorHandlers(ErrorHandler)
    .withApiClient(new alexa_info.DefaultApiClient())
    .lambda();

    alexa.APP_ID = APP_ID;
    alexa.registerHandlers(handlers);
    alexa.execute();
};

and my launch Request is :

const LaunchRequest = {
  canHandle(handlerInput) {
    return handlerInput.requestEnvelope.request.type === 'LaunchRequest';
  },
  handle(handlerInput) {
    return handlerInput.responseBuilder.speak(messages.WELCOME)
        .reprompt(messages.HELP)        
        .reprompt(messages.WHAT_DO_YOU_WANT)
        .getResponse();
  },
};

const LaunchRequestHandler = {
  canHandle(handlerInput) {
    return handlerInput.requestEnvelope.request.type === 'LaunchRequest';
  },
  handle(handlerInput) {
    const speechText = messages.WELCOME;
    const reprompt = messages.WHAT_DO_YOU_WANT;

    return handlerInput.responseBuilder
      .speak(speechText)
      .reprompt(reprompt)
      .withSimpleCard(APP_NAME, speechText)
      .getResponse();
  },
};

So: 1- when I call the skill "alexa, open" mySkillName "he replies that there is an error with the response of the skill. While I would like the string contained in the message constant to return. WELCOME 2- alexa.registerHandlers (handlers); it works, it allows me to make all the functions I created inside it work, while the part of code linked to skillBuilder does not return: when I try to test it it does not work, for example, returning the message: "No handler function was defined for event GreetMeIntent. This is the error:

"errorType": "Error", "errorMessage": "In state: . No handler function was defined for event GreetMeIntent and no 'Unhandled' function was defined.", "trace": [ "Error: In state: . No handler function was defined for event GreetMeIntent and no 'Unhandled' function was defined.", " at AlexaRequestEmitter.EmitEvent

thank you for your help

  • What exactly isn't working? – MrToast Feb 21 '20 at 13:07
  • @ooorndtski 1- when I call the skill "alexa, open" mySkillName "he replies that there is an error with the response of the skill. While I would like the string contained in the message constant to return. WELCOME 2- alexa.registerHandlers (handlers); it works, it allows me to make all the functions I created inside it work, while the part of code linked to skillBuilder does not return: when I try to test it it does not work, for example, returning the message: "No handler function was defined for event GreetMeIntent –  Feb 21 '20 at 13:34
  • "errorType": "Error", "errorMessage": "In state: . No handler function was defined for event GreetMeIntent and no 'Unhandled' function was defined.", "trace": [ "Error: In state: . No handler function was defined for event GreetMeIntent and no 'Unhandled' function was defined.", " at AlexaRequestEmitter.EmitEvent (/var/task/node_modules –  Feb 21 '20 at 13:58
  • Please edit your question to add this extra information in, rather than post it as comments. – David Buck Feb 21 '20 at 14:56

0 Answers0