Problem with Null SpeechletResponse (Alexa)

Something went wrong with my AMAZON.StopIntent. No matter what I put there (I tried everything from each textbook), whenever he called, I get “There was a problem with the requested answer to the skill”, and the Alexa application shows an error, because “the response of the voice message cannot be zero " My project is in JSON format, not in Java format.

If anyone can help, I am very grateful for that!

Thanks!

As requested here, what is Lambda going to

{ "session": { "sessionId": "SessionId.XXXXX", "application": { "applicationId": "amzn1.ask.skill.XXXXXXX" }, "attributes": {}, "user": { "userId": "amzn1.ask.account.XXXXXXX" }, "new": true }, "request": { "type": "IntentRequest", "requestId": "EdwRequestId.XXXXXX", "locale": "en-US", "timestamp": "2017-01-18T22:38:53Z", "intent": { "name": "AMAZON.StopIntent", "slots": {} } }, "version": "1.0" } 

And here is the corresponding code:

 var handlers = { 'LaunchRequest': function () { this.emit('AMAZON.HelpIntent'); }, 'GetNewDogThoughtIntent': function () { this.emit('GetDogThought'); }, 'GetNewCatThoughtIntent': function () { this.emit('GetCatThought'); }, 'GetDogThought': function () { var dogthoughtIndex = Math.floor(Math.random() * DOGTHOUGHTS.length); var randomDogThought = DOGTHOUGHTS[dogthoughtIndex]; // Create speech output var speechOutput = "Your dog is thinking, " + randomDogThought; this.emit(':tellWithCard', speechOutput, "Your dog was thinking... ", randomDogThought); }, 'GetCatThought': function () { var catthoughtIndex = Math.floor(Math.random() * CATTHOUGHTS.length); var randomCatThought = CATTHOUGHTS[catthoughtIndex]; // Create speech output var speechOutput = "Your cat is thinking, " + randomCatThought; this.emit(':tellWithCard', speechOutput, "Your cat was thinking... ", randomCatThought); }, 'AMAZON.HelpIntent': function () { var speechOutput = "You can ask me for what your cat or dog is thinking, or you can say exit... Right now I can only provide thoughts for one cat or dog at a time... What can I help you with?"; var reprompt = "What can I help you with? Make sure to say if your pet is a cat or dog when you ask!"; this.emit(':ask', speechOutput, reprompt); }, 'SessionEndedRequest': function (sessionEndedRequest, session) { }, "AMAZON.StopIntent": function (shouldEndSession) { } 
+6
source share
3 answers

I finally got it after consulting with the SpaceGeek tutorial and making some changes to it. Basically, this is what worked:

 'AMAZON.StopIntent': function () { this.emit(':tell', "Goodbye!"); 

}

The key was ':tell' , which I did not have before. Thanks to everyone who answered and helped!

+4
source

Can you post your code for StopIntent? You must name the response replicas in it. For instance:

 'AMAZON.StopIntent': function (shouldEndSession, response) { var speechOutput = "Goodbye"; response.tell(speechOutput); }, 

Do you build the answer correctly and pass it on?

+1
source

I found this link on the alexa developer forum. This may help in your problem.

https://forums.developer.amazon.com/questions/49211/system-error-speechletresponse-was-null.html

I am writing this code in php if this helps

 $data = file_get_contents("php://input"); $jsonData = json_decode($data); if($jsonData->request->type === "IntentRequest"){ $IntentName = $jsonData->request->intent->name; if($IntentName === "AMAZON.StopIntent"){ $response = '{ "version" : "1.0", "response" : { "outputSpeech": { "type": "PlainText", "text": "" }, "shouldEndSession" : false } }'; echo $response; } } 
0
source

Source: https://habr.com/ru/post/1013642/


All Articles