question

vila avatar image
vila asked

Echo disregards should end session variable

Hi, Im working on an external web service that I host in a vps server. Im using python and flask. So far Im struggling to maintain a conversation with Alexa. AFAIK,  the "shouldEndSession": boolean instructs Echo to continue listening after I send a response back to the device, (or maybe I got it all wrong) and wether or not the session should end and create a new session id and state for the next request. No matter what value i put on that variable, Echo will always read the text back but as soon as it ends, the blue ring turns off and I cant interact any more with Echo, I have to invoke again. Am I missing something fundamental here? Below an example of a request reponse that i captured on my apache logs. request i get: [Thu Aug 27 09:45:19.080295 2015] [wsgi:error] [pid 28267:tid 140293485618944] {u'session': {u'new': True, u'sessionId': u'amzn1.echo-api.session.XXXXXXX', u'user': {u'userId': u'amzn1.account.YYYYYYYY'}, u'application': {u'applicationId': u'amzn1.echo-sdk-ams.app.ZZZZZZZZZ'}}, u'version': u'1.0', u'request': {u'timestamp': u'2015-08-27T07:45:18Z', u'type': u'LaunchRequest', u'requestId': u'amzn1.echo-api.request.MMMMMMM'}} the response i send [Thu Aug 27 09:45:19.080387 2015] [wsgi:error] [pid 28267:tid 140293485618944] {"version": "0.1", "shouldEndSession": "false", "response": {"outputSpeech": {"text": "Hi, I can help you with that, do you want me to play the piano?", "type": "PlainText"}, "card": {"content": "YEAP YEAP", "type": "Simple", "title": "EXAMPLE"}}} I read on another post here that the user had an issue with the Json he was returning. I cant find an error in mine though. Im trying to build an app so my kids can play with Echo! any help appreciated! Evelio
alexa skills kitsubmission testing certification
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
Looks OK to me. What I would do is start by responding with the canonical "good" response from the examples: [code] { "version": "1.0", "sessionAttributes": {}, "response": { "outputSpeech": { "type": "PlainText", "text": "Your favorite color is blue, goodbye" }, "card": { "type": "Simple", "title": "SessionSpeechlet - WhatsMyColorIntent", "content": "SessionSpeechlet - Your favorite color is blue, goodbye" }, "reprompt": { "outputSpeech": { "type": "PlainText", "text": null } }, "shouldEndSession": true } } [/code] See if that works. If it does, start changing elements to be from your program rather than static. See at which point it ceases to work. That, then, is what's wrong.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Naikel avatar image
Naikel answered
The shouldEndSession value should be INSIDE the response object, like in the example jjaquinta showed.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.