Can I use Python to build an action for Google Home

Tushar Aggarwal picture Tushar Aggarwal · Aug 31, 2017 · Viewed 10.8k times · Source

I am starting development of Google Home actions and would like to do so with the Python language instead of node js, provided in the getting started tutorial at https://developers.google.com/actions/get-started/.

I was going through the tutorial and was stuck at the point where it requires the use of node js for the demo facts app.

I need to use Python for this, as mentioned above. (I think web hooks are something of importance here. Not sure what they are.)

Answer

Guardius picture Guardius · Oct 5, 2017

The webhook is the callback that is called by the action. It will receive a JSON payload with all of the context data from Google Assistant. Google will send a POST request to whatever service you specify in the API.AI console as the webhook. It is then up to you to send a response back to Google so that it can 'render' that response on the client device. You can use flask or any other Python framework to process the POST request and generate your response.

Remember that Google Assistant can run on a variety of platforms and as such, you will want to look at the 'surface' parameter to specialize your response payload for the device you are responding to.