使用Api.ai从Google Actions请求用户位置

编程入门 行业动态 更新时间:2024-10-09 18:17:08
本文介绍了使用Api.ai从Google Actions请求用户位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Google操作可以为您提供用户的位置,名称和其他一些详细信息。没有nodejs SDK的情况下如何在Api.ai上完成? Google的所有示例均使用Nodejs sdk。

Google Actions can provide you with the user's location, name, and few other details. How can this be done on Api.ai without the nodejs SDK? All examples from Google are using the Nodejs sdk.

根据会话Api 只是将正确的json放入响应中,但是还不清楚如何获取Api.ai来填充此json。

According to the Conversation Api it is just a matter of putting the correct json in the response, however it is unclear how to get Api.ai to fill in this json.

我已在此处阅读文档,但仍不清楚。

I've read the docs here , but am still unclear.

示例代码或更详细的文档对于非nodejs开发人员来说非常有用。我正在Java中工作,但是对Api.ai如何为Google Actions构建响应json的一个很好的解释将对所有语言的开发人员有所帮助。

Sample code, or more detailed documentations, would be great for the non nodejs developers. I'm working in Java, however a good explanation of how Api.ai builts the response json for Google Actions would be helpful for developers of all languages.

推荐答案

您必须在此处中研究API。作为参考,尝试设置节点示例-这样您可以看到实际的JSON文件。

You have to study the API.AI HTTP API here. As a reference, try to setup the node examples - this way you can see the JSON files in action.

对于权限,请尝试

For the permissions try the Name Psychic example.

您的传出JSON将如下所示:

Your outgoing JSON will be something like this:

{ "contextOut": [ { "lifespan": 100, "name": "_actions_on_google_", "parameters": {} }, { "lifespan": 1, "name": "requesting_permission", "parameters": {} } ], "data": { "google": { "expect_user_response": true, "is_ssml": false, "no_input_prompts": [], "permissions_request": { "opt_context": "To send you something", "permissions": [ "DEVICE_PRECISE_LOCATION" ] } } }, "speech": "PLACEHOLDER_FOR_PERMISSION" }

更多推荐

使用Api.ai从Google Actions请求用户位置

本文发布于:2023-11-28 04:54:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641033.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:位置   用户   ai   Api   Actions

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!