question

R. Labanca avatar image
R. Labanca asked

App initiated speech?

Alexa, find me the best price on cars in nyc "Searching for cars in nyc" 25 seconds goes by "Found 5 sedans" How do I do this? Right now the only way I see a long running request working is just silence, which seems unfriendly. It also seems unfriendly to put in a fake prompt like "are you sure you wand to search for cars in Nyc?" I. also unsure what it out there is for a long running process. My process can take up to 30 seconds, there's no way around that, so any idea about speeding it up isn't possible.
alexa skills kit
10 |5000

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

James Chivers avatar image
James Chivers answered
AFAIK, there's no way to execute a request for that length of time before a timeout is reached and Alexa will complain that it's having an issue with your app. If we get push notifications, then you can totally achieve this. One thing you could do is ask the user to wait and ask again - caching their initial request for them in the meantime, but that's horrible. User: "How many cars are there in NYC?" Alexa: "I'll check - please ask me again in 30 seconds" I like your idea of hitting the user with another question whilst you search asynchronously, to draw the time out as a possible hack - and maybe your app could legitimately ask for clarification of some aspect (and not just a confirmation)? Or tell the user a joke? :) Or - how about just being frank with the user and asking for them to confirm that you should continue searching when it needs more time?, e.g.: User: "How many cars are there in NYC?" [ app starts search ] Alexa: "I'll check - it's taking a little time - should I continue?" [ app continues search ] User: "Yes" [ app continues search ] Alexa "Ok, here you go..." I don't know your app, and I know you said you can't speed up the querying or computation on your backend, but - is it possible to at least identify and cache the expected most common queries you might receive?
10 |5000

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

Nick Gardner avatar image
Nick Gardner answered
If you have a long process, there is no way to get the service to simply wait until your reply is ready. If your service doesn't send back anything within a few seconds, it will be assumed to have timed out and the Echo will say the error message. The best solutions I can think of are caching to improve the service time, using a longer dialogue to build up the query over time and give more time for each part, or to simply give the user the results at a later time when they access the app. Thanks, Nick
10 |5000

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

R. Labanca avatar image
R. Labanca answered
Ouch that kills my app! I'm guessing if echo succeeds it will have to enable a solution for this. I know most things are fast or instant but a few aren't. I think the ideas for pushing prompts is a great idea that could solve this and other things. Then I cold start my long process and come back later allowing the user to continue in the same context. Disappointed for now!
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
I followed up my "Streaming Text" feature request with an implementation suggestion that would let and app give the Echo a "callback" to invoke instead of a timeout utterance. That would also help solve your problem too. Kind of like in Javascript where you have a long running server process and the client "phones home" occasionally to see if it's done. https://forums.developer.amazon.com/forums/thread.jspa?threadID=5459&tstart=0
10 |5000

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

Amazon Customer avatar image
Amazon Customer answered
I am facing the same timeout issue. Also on my local laptop, I could make service call within 1s and it works fine. When executed through Lambda it's taking more than 3s. I feel this is a Lambda execution engine problem too. It should not take 3 times the time from Amazon cloud. This also means Alexa Skills interface should support asynchronous responses to intent requests. Is that feature prioritized? This is indeed very disappointing.
10 |5000

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

Matt Cashatt avatar image
Matt Cashatt answered
I agree that this could be a problem and, while I know ideas are the easy part, here are a few of mine to throw on the pile for Amazon's consideration: 1. Revise the skills kit to allow for async processing and callbacks (as others have suggested) 2. Allow push notifications (as others have suggested) 3. Provide callback URLs and allow developers more control over customizing cards in the companion app so that a request can be issued to a server and then once the server has done it's thing it can post a response to a predetermined URL so that (as in the OPs example) the list of cars can then be displayed in the companion app. 4. As part of the SDK, provide a method we can call that allows us to use the same "progress spinner" (the spinning ring of LED lights) that Echo uses. Possibly couple this with voice messages at certain intervals to let the user know that your app is still working (e.g. "Still looking" every 10 seconds). Thanks, MC
10 |5000

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