且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我可以使用 Python 为 Google Home 构建操作吗

更新时间:2022-01-08 23:16:15

webhook 是由操作调用的回调.它将从 Google Assistant 接收包含所有上下文数据的 JSON 负载.Google 会向您在 API.AI 控制台中指定为 webhook 的任何服务发送 POST 请求.然后由您将响应发送回 Google,以便它可以在客户端设备上呈现"该响应.您可以使用 Flask 或任何其他 Python 框架来处理 POST 请求并生成响应.

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.

请记住,Google 智能助理可以在各种平台上运行,因此,您需要查看表面"参数以专门针对您正在响应的设备的响应负载.

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.