alexa / alexa-skills-kit-sdk-for-python

The Alexa Skills Kit SDK for Python helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
https://developer.amazon.com/en-US/docs/alexa/alexa-skills-kit-sdk-for-python/overview.html
Apache License 2.0
809 stars 204 forks source link

Issue with Calling Progressive Response API #11

Closed cruales closed 6 years ago

cruales commented 6 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Expected Behavior

After invoking an intent that uses a progressive response it should return the message ("Okay, please wait") and then finish the rest of the intent.

Current Behavior

Getting these errors and no progressive response:

“Couldn't parse response body: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'header': was expecting ('true', 'false' or 'null')”

and

"Directive not valid" even when the directive is valid according to the alexa developer docs for progressive responses. (https://developer.amazon.com/docs/custom-skills/send-the-user-a-progressive-response.html#send-directive)

Steps to Reproduce (for bugs)

Code snippet for progressive response:

from ask_sdk_model.services.directive import ( SendDirectiveRequest, Header, SpeakDirective)

def call_directive_service(handler_input): request_id_holder = handler_input.request_envelope.request.request_id

directive_header = Header(request_id=request_id_holder)
speech = SpeakDirective(speech="Ok, please wait")

directive_request = SendDirectiveRequest(header=directive_header, directive=speech)
return handler_input.service_client_factory.get_directive_service().enqueue(directive_request)

How to call it in an intent handler:

try: call_directive_service(handler_input) except Exception as e: print(e)

Python version info

nikhilym commented 6 years ago

The issue has been fixed in release 0.1.2. Please update to the latest SDK and test it out.