DeanCording / node-red-contrib-google-action

A Node Red node to respond to Google Action requests
MIT License
37 stars 15 forks source link

Upgrade to Action SDK 2.0, add simpleResponse, basicCard, browseCarousel, carousel, image and suggestions #17

Open nobodyMO opened 5 years ago

DeanCording commented 5 years ago

Thanks Marcus,

I did have a look at using the API V2 but it was becoming too cumbersome to integrate with Node Red due to some fundamental design differences.

I've been working on a V2.0 of this node which does away with needing to use Google's API V2 and uses webhooks instead. This has led to a much more flexible design that allows you to build dialogs within Node Red itself, much like Google's Dialog.

An alpha test version is available here under the alpha-2.0 tag. Have a look at https://discourse.nodered.org/t/node-red-contrib-google-action-2-0-0-alpha-released/5514 for more details.

Let me know what you think, I wouldn't want your work to go to waste. Maybe we could provide both versions if they serve a purpose.

Cheers,

Dean

nobodyMO commented 5 years ago

Hi Dean, the new Action SDK is really a challenge for flow-based systems like node-red. Unfortunately, it is not trivial to interrupt the intent handler and continue the conversation asynchronously at another location. I solved this with my solution in such a way that I stored the callback function for the success trigger in the promise function in a global array which can then be called from the out node. The real processing remains in the Intent Handler of the In-Node. The webhook interface is of course always an alternative, since the node.js SDK also uses the JSON format, everything is possible. But my use case for the node seems to be a bit different. I use the voice control primarily to control my house via my smartphone with the Google Assistant. Here I don't only want to do voice in- and output, but e.g I want to be able to display current pictures of my webcams and click on them to see a large picture, show Information an options on the display. For this I also need the complex answering types. If the webhook based node generates the JSON without the constructors and the checks within the node.js client and sends JSON directly, the generation of the JSON would either have to happen in the flow and then only be passed through without validation inside the out-node or be completely programmed in the node-red node itself. Even if the node.js client doesn't do much more than serialization at the moment and still has a lot of bugs and inconsistencies, that would be too much effort in my eyes.

Cheers,

Markus