Progressive Response for a longer time(my API response time more than 25 seconds)

amazon-alexa

#1

Hello Everyone, It is possible 25 seconds to wait for Alexa using progressive response. bcz my API response after 22 to 25 seconds. but Alexa gives “SpeechletResponse was null” error. please help me if any idea regarding that. and another way to handle this.

	    "request": {
		"type": "SessionEndedRequest",
		"requestId": "amzn1.echo-api.request.5aa22187-d0c7-48cc-9ed9-186302f007c6",
		"timestamp": "2020-03-05T08:09:52Z",
		"locale": "en-IN",
		"reason": "ERROR",
		"error": {
			"type": "INVALID_RESPONSE",
			"message": "SpeechletResponse was null"
		}
	}

#2

As far as I know you can keep the session open by setting the shouldEndSession param. See https://www.jovo.tech/docs/v2/requests-responses#sessions and https://developer.amazon.com/ja/docs/alexa/echo-button-skills/keep-session-open.html.

However talking about ux you really think a user will wait 25seconds? I doubt it


#3

Thanks, @H1Gerd for your reply.

You are right user can not wait 25 seconds. but we can play Audio while processing time.
I think need to optimize my API response time.

because Progressive responses do not change the overall time allowed for a response. When a user invokes a skill, the skill has approximately 8 seconds to return a full response. The skill must finish processing any progressive responses as well as the full response within this time.


#4

I have faced a similar problem and used a workaround. My approach uses a job queue or other asynchronous worker. When the user triggers the long-running activity you would trigger the background job and mmediately reply to the user with an. " That will take a few seconds <<play 20 second sound clip>>. 3… 2… 1… Now please say okay to hear your results.". You trigger on the next intent and retrieve the work from the job queue. Should be kinder to your server if you’re not using lambda (rather than blocking on the request.