No response from any other intent request except Launch request

前端 未结 1 1427
误落风尘
误落风尘 2021-01-26 02:41

I\'m new to Alexa skill creation. I tried to create a skill for my term project in college and am trying to finish it. I\'ve finally got the Lambda and interaction model commu

相关标签:
1条回答
  • 2021-01-26 02:57

    You have a couple of things to be corrected.

    1. LaunchRequest:
      It is LaunchRequest and not LaunchIntent. When you invoke a skill, this is the handler which will be called.
    2. context.succeed:
      You don't need context.succeed(handlers());, you can remove it from all the intent handlers.
    3. shouldEndSession:
      If this parameter is not set or if it is set to true, Alexa will end the current session and your skill will be closed. No subsequent user speech will reach your backend code unless you invoke it again.

    The good thing is that, you don't have to set this parameter manually and the SDK will take care of it as follows:

    1. :ask: will 'ask' the user and wait for a response by keeping the session alive. If you set a re-prompt, it will be triggered after 8 seconds if there is no interaction from user.
      ask: will automatically include "shouldEndSession":"false" in response.

    Ex:

    'AbcIntent': function () {
       var speech="Your speech here";
       var reprompt="Your re-prompt here";
       this.emit(':ask', speech,reprompt);
    }
    
    1. :tell will just say the response and end the session. Use this when you don't expect any response from user. Ex: use it for AMAZON.StopIntent.
    2. speak() and listen(): if there is no listen(), speak() will be treated as :tell, it just tell the response and set "shouldEndSession":"true" in response which will end the session. But if there is a listen(), the SDK will set "shouldEndSession":"false" in response and will keep the session alive.

    Make your changes like this:

    "LaunchRequest": function () {
        this.response
           .speak("Hello, Welcome to Family Table.  where would you like to make a reservation today?")
           .listen("where would you like to make a reservation today?");
        this.emit(':responseReady');        
    }
    

    Or use :ask

    "FoodIntent": function () {
      const speech = "What kind of food would you like today?";
      const reprompt = "What kind of food would you like today?";
      this.emit(':ask',speech,reprompt);       
    }
    
    0 讨论(0)
提交回复
热议问题