0
votes

I have a skill, I'm trying to test it with the "test" function in alexa developer console. If I give the invocation name, it gets recognized to be the specific intent, but the response doesn't match. (It might be something glaringly obvious that I just can't notice anymore.)

I have a LaunchRequest type, it works with the invocation name.

const LaunchRequestHandler = {
  canHandle(handlerInput) {
    return handlerInput.requestEnvelope.request.type === 'LaunchRequest';
  },
  handle(handlerInput) {


    welcomeMessage = `updated welcome`;
    return handlerInput.responseBuilder
      .speak(welcomeMessage)
      .reprompt(helpMessage)
      .getResponse();
  },
};

(welcomeMessage is declared outside, this was just testing if the issue was giving it new value)

However, when it comes to an intent based on user input (in this case TestIntent, the user input is "is the skill working"), it just doesn't work. TestIntent's code is the same as LaunchRequest, except the intent type&name check

const request = handlerInput.requestEnvelope.request;
return (request.type === "IntentRequest" &&
request.intent.name === "TestIntent");

The alexa skill's json input recognizes the input as a TestIntent

"request": {
    "type": "IntentRequest",
    "requestId": "amzn1.echo-api.request.601d2e89-71c1-417e-b878-790afc6f79f4",
    "timestamp": "2019-08-12T07:01:38Z",
    "locale": "en-US",
    "intent": {
        "name": "TestIntent",
        "confirmationStatus": "NONE"
    },
    "dialogState": "STARTED"
}

But the response is just "I am sorry, but I do not know that. Can you repeat that?"

1

1 Answers

0
votes

You need to create your custom intent with utterances.

Sample:

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "mySkill",
            "intents": [
                {
                    "name": "TestIntent",
                    "slots": [
                        {
                            "name": "name",
                            "type": ""
                        }
                    ],
                    "samples": [
                        "test me", // This would be your utterance to identify intent
                        "testing you" // You can have multiple
                    ]
                },
                {
                    "name": "AMAZON.FallbackIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.NoIntent",
                    "samples": []
                }
            ]
        }
    }
}

Below is the walkthrough to the developer account

1) Create your intent

enter image description here

2) Create your utterances

enter image description here

And then just build your modal. Your Skill needs to be linked to your lambda function.

Hope this help!

======UPDATE=====

Need to return card response

response = {
      outputSpeech: {
        type: "PlainText",
        text: output
      },
      card: {
        type: "Simple",
        title: title,
        content: output
      },
      shouldEndSession: shouldEndSession
    };

Using aw-sdk: (Sample)

return handlerInput.responseBuilder
      .speak(speechText)
      .reprompt(speechText)
      .withSimpleCard('Hello World', speechText)
      .getResponse();
  }