1
votes

I'm trying to develop a custom skill using Alexa skill set. While testing in a simulator, when a sample utterance entered it is able to hit the API endpoint. But I'm not able to find the user expression(what user has spoken) in the request body (see below) sent to my API endpoint. Like i also require what user has spoken when alexa triggers fallback intent. Is there a way we can also send user spoken text to my endpoint (so that i can send that text to LUIS/api.ai). Same thing I have checked with google assistant(actions on google) which sends the user spoken text to API endpoint.

{
   "version":"1.0",
   "session":{
      "new":false,
      "sessionId":"amzn1.echo-api.session.xxxxxxxxxxxxxx-6de9eeb174c5",
      "application":{
         "applicationId":"amzn1.ask.skill.xxxxxxxxxxxxxxxxx"
      },
      "attributes":{
         "key":null
      },
      "user":{
         "userId":"amzn1.ask.account.AG4ZW2AIRMFQEPZFLxxxxxxxxxxxxxxxxxxxxxxx"
      }
   },
   "context":{
      "System":{
         "application":{
            "applicationId":"amzn1.ask.skill.xxxxxxxxxxxxx"
         },
         "user":{
            "userId":"amzn1.ask.account.xxxxxxxxxxxxxxxxx"
         },
         "device":{
            "deviceId":"amzn1.ask.device.xxxxxxxxxxxxxxxxxxxxxxxx",
            "supportedInterfaces":{
            }
         },
         "apiEndpoint":"https://api.amazonalexa.com",
         "apiAccessToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
   },
   "request":{
      "type":"IntentRequest",
      "requestId":"amzn1.echo-api.request.28fd7f8b-ef02-4b64-8758-edaecbd0a92b",
      "timestamp":"2018-06-25T07:32:13Z",
      "locale":"en-US",
      "intent":{
         "name":"GetWeather",
         "confirmationStatus":"NONE",
         "slots":{
            "City":{
               "name":"City",
               "value":"New York",
               "confirmationStatus":"NONE"
            }
         }
      }
   }
}
1

1 Answers

2
votes

Alexa does not provide the user input in the request JSON.

However, you can create a slot with slotType: SearchQuery. That is the most flexible slotType and can be filled with almost the full input of the user.

AMAZON.SearchQuery:

...consider using a built-in or custom slot type to capture user input that is more predictable, and the AMAZON.SearchQuery slot type to capture less-predictable input...

{
  "intents": [
    {
      "name": "SearchIntent",
      "slots": [
        {
          "name": "Query",
          "type": "AMAZON.SearchQuery"
        },
      ],
      "samples": [
        "search for {Query} near me",
        "find out {Query}",
        "search for {Query}",
      ]
    }
  ]
}

Side Note: Amazon Lex is "Powered by the same deep learning technologies as Alexa" and Lex does provide the exact user input in the request JSON.