alexa-js / alexa-app

A framework for Alexa (Amazon Echo) apps using Node.js
https://www.youtube.com/watch?v=pzM4jv7k7Rg
MIT License
1.03k stars 213 forks source link

Custom Data payloads using AVS #221

Open Shagans982 opened 7 years ago

Shagans982 commented 7 years ago

I've gone through the Alexa Voice Service docs and apis here but can't seem to find mention of how to send a custom data payload as part of the response to AVS. I have an iPad using the AVS service and have this module implemented. Are you aware if this is possible using alexa-app? The end goal is to be able to setup UI state on the iPad.

dblock commented 7 years ago

What does this look like in the response JSON?

Shagans982 commented 7 years ago

@dblock Not sure I understand completely. I get a directive sent down from AVS. Something like this. { "directive": { "header": { "namespace": "SpeechRecognizer", "name": "StopCapture", "messageId": "{{STRING}}", "dialogRequestId": "{{STRING}}" }, "payload": { } } }

dblock commented 7 years ago

Does this.response.response.payload = ... work?

Shagans982 commented 7 years ago

This is sent from AVS but as far as the interface to AVS (via this module), I don't see a way.

ericblade commented 7 years ago

I don't think there's any way to affect the AVS response via the skill interface. The directives received back from SpeechRecognizer are how to handle interaction with the user (play audio file, play another audio file, start listening again, etc)

Can you point to anything in the AVS documentation that would seem to indicate that a skill can somehow affect the AVS responses, other than by sending a Card or a Speech ?

Shagans982 commented 7 years ago

@ericblade No, I cannot. Which is what led to my question. Just seems odd that you cannot pass down any custom data to your AVS client via a custom skill. I'm creating a bot experience with voice complete with a UI on an iPad so being able to setup UI state is desirable. If not, I'll just have to run a separate service connecting the iPad to our node server that manages the skill. Which seems unnecessary. I guess Amazon strictly limits AVS clients to only being audio based.

ericblade commented 7 years ago

Yea, it doesn't seem like using the available APIs that there's a real good path to being able to implement building new device experiences. Now, I haven't really looked too in depth into V2 of the API, so there may be ways to do things like this, but I was thinking (keep in mind, I only know the V1 API right now), how would someone implement another device, if you can't realistically parse the command before Alexa responds to it?

ericblade commented 7 years ago

@Shagans982 I suspect we will probably see some things along the lines of this for supporting Echo Show. In the meantime, I have implemented a cloud service that devices connect to, which my skill can use to send and retrieve information.