简体   繁体   English

从 GOOGLE ASSISTANT 到 PRIVATE SERVER 的 HTTP POST 并转换语音响应

[英]HTTP POST from GOOGLE ASSISTANT to PRIVATE SERVER and convert response in voice

I want use Google Assistant from my phone to send HTTP POST command to my server.我想使用手机中的 Google Assistant 将 HTTP POST 命令发送到我的服务器。 I have a simple webnms app running over it, this server support REST API and now I want to use Google Assistant to shoot GET or POST command to that server and return my output.我有一个简单的 webnms 应用程序在它上面运行,该服务器支持 REST API,现在我想使用 Google Assistant 向该服务器发送 GET 或 POST 命令并返回我的输出。

Is it something possible?有什么可能吗? I am not full time developer.我不是全职开发人员。

Yes, as @Prisoner says it is possible.是的,正如@Prisoner 所说,这是可能的。 It is not what you asked - but have you seen these ways that Google provides to get skills published without requiring a lot of developer savvy?这不是您要问的 - 但您是否见过 Google 提供的这些方法来发布技能,而无需精通大量开发人员?

https://developers.google.com/actions/content-actions/ https://developers.google.com/actions/content-actions/

https://developers.google.com/actions/templates/first-app https://developers.google.com/actions/templates/first-app

I don't speak for them, but IMO Google's target audience for Action building apart from the above is those who have at least some familiarity with the JavaScript language and its "run-time" Node.我不代表他们说话,但除上述之外,IMO Google 的 Action 构建的目标受众是那些至少熟悉 JavaScript 语言及其“运行时”Node.js 的人。

There is also this - which I haven't tried by the way.还有这个 - 顺便说一下,我还没有尝试过。

https://www.techadvisor.co.uk/how-to/digital-home/easy-actions-google-assistant-3665372/ https://www.techadvisor.co.uk/how-to/digital-home/easy-actions-google-assistant-3665372/

In case it is not obvious, Google Actions are essentially websites that interact with Google's assistant running on a Home device or a smart phone, say.如果不明显,Google Actions 本质上是与在 Home 设备或智能手机上运行的 Google 助手进行交互的网站,例如。 Think of the Assistant as a browser initiating requests and your Action as serving them.将 Assistant 视为发起请求的浏览器,将您的 Action 视为为它们提供服务。 If you can (build and?) deploy a server that handles POSTS over HTTPS on a publicly addressable URL, and if you can understand the JSON payload that the Assistant sends and respond with appropriate JSON to carry out you application then you are good to go.如果您可以(构建和?)部署一个服务器,在可公开寻址的 URL 上通过 HTTPS 处理 POSTS,并且如果您可以理解助手发送的 JSON 有效负载并使用适当的 JSON 响应以执行您的应用程序,那么您就可以开始了.

Where you don't have a public IP address - eg in testing - you can use a tool like ngrok ( https://ngrok.com/ ) to reverse proxy requests emanating from the Assistant to your server.如果您没有公共 IP 地址(例如在测试中),您可以使用类似 ngrok ( https://ngrok.com/ ) 之类的工具来反向代理从助手发出的请求到您的服务器。

I have slides for a presentation I did targeting fledgling developers who had never built an Action here我有一个演示文稿的幻灯片,我针对从未在这里构建过 Action 的初出茅庐的开发人员

https://docs.google.com/presentation/d/1lGxmoMDZLFSievf5phoQVmlp85ofWZ2LDjNnH6wx7UY/edit?usp=sharing https://docs.google.com/presentation/d/1lGxmoMDZLFSievf5phoQVmlp85ofWZ2LDjNnH6wx7UY/edit?usp=sharing

and the code that goes with it here和它的代码在这里

https://github.com/unclewill/parrot https://github.com/unclewill/parrot

On the upside the code is about as simple as it gets.从好的方面来说,代码非常简单。 On the downside it does almost nothing.不利的一面是它几乎什么都不做。 In particular, it doesn't try to understand language.特别是,它不会试图理解语言。 As @Prisoner says you'll likely need a tool like Dialog Flow for that.正如@Prisoner 所说,您可能需要一个像 Dialog Flow 这样的工具。

Yes, it is possible.是的,这是可能的。

Your server will need to implement the Actions on Google API .您的服务器将需要实现Actions on Google API This is a REST API which will accept JSON containing what the user is intending to do and specific information about what they have said.这是一个 REST API,它将接受 JSON,其中包含用户打算执行的操作以及有关他们所说内容的特定信息。 Your server will need to send back JSON indicating the reply, along with additional information about how to continue the conversation.您的服务器需要发回 JSON 以指示回复,以及有关如何继续对话的其他信息。

You will likely also want to use a tool such as Dialogflow to handle building the conversational script and converting a user's phrases into something that makes sense to you.您可能还想使用Dialogflow 之类的工具来处理构建对话脚本并将用户的短语转换为对您有意义的内容。 You'll also need to use the Actions on Google console to manage your Action and provide additional details about how users contact your Action.您还需要使用 Actions on Google 控制台来管理您的 Action 并提供有关用户如何联系您的 Action 的更多详细信息。 All of this is explained in the Actions on Google documentation .所有这些都在Actions on Google 文档中进行了解释。

Simple Actions are fairly easy to develop, and can certainly be done by a developer as a hobby.简单操作相当容易开发,当然可以由开发人员作为爱好来完成。 Good Actions, however, take a lot more thought and planning.然而,好的行动需要更多的思考和计划。 Google offers you to the tools - it is up to you to best take advantage of them. Google 为您提供了工具 - 由您决定如何最好地利用它们。

I've found the solution.我找到了解决方案。 In the "Action" console https://console.actions.google.com/project/sandbox-csuite/scenes/Start Go to menu "Webhook", click "Change fulfillment method", and then select "HTTPS endpoint"在“操作”控制台https://console.actions.google.com/project/sandbox-csuite/scenes/Start转到菜单“Webhook”,单击“更改履行方法”,然后选择“HTTPS 端点”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM