How to integrate with Google Assistant SDK?

I want to use Google Assistant to control my Particle devices and Actions on Google platform requires a webhook url that Google will invoke to communicate with the device. What is the best way to expose Particle devices to Google Assistant in such way?

I’ve tried searching for “webhook” but all existing topics seem to be about device-to-cloud communication and I need it in the opposite direction.

hi, not exactly a webhook url, but maybe a cloud function url would do?

Unfortunately it won’t work because an invocation syntax is incompatible.

You can create a google cloud function/amazon lambda function which is the fulfilment address of your actions on google app. Then you cloud function can make api calls to your particle device.

1 Like

This looks like a promising suggestion. Have you by any chance seen any examples? There are multiple moving parts involved (particle, aws/gcp, assistant) and if there are any proven implementations, that could save a lot of time.

actions on google has a bunch of tutorials to follow that go through the basics at https://developers.google.com/actions/codelabs/

hey Oleg,
out of curiosity, would you mind elaborating?
thanks!

Sure. The fulfillment syntax is on the linked page. As you can see, the request is passed through POST body. If you compare that with a syntax to call a function then you'll see that it requires a single "arg" parameter with a very limited length.

So unless you know a way for particle api to accept the entire request as-is, it would require an intermediate lambda function to convert one format into another.

correct, thank you for providing more info about it.
An alternative to a lambda could be a Google Cloud function (since you are already in the Google Cloud with the Google Assistant)
thanks