简体   繁体   English

我希望我的Google Assistant应用程序先与我的网络服务器对话,然后再与dialogflow对话

[英]I want my google assistant application to talk to my webserver first and then dialogflow

I want my Google Assistant application to talk to my webserver first and then Dialogflow. 我希望我的Google Assistant应用程序先与我的网络服务器对话,然后再与Dialogflow对话。 The way DialogFlow is documented, the Assistant talks to it first, and then it is passed to my webhook. 记录DialogFlow的方式,助手首先与之对话,然后将其传递到我的webhook。 I want to do it the other way. 我想换一种方式。

Google Assistant的技术架构

To have the Google Assistant talk directly to your server (without Dialogflow in between) you need to use the Actions SDK . 要使Google Assistant直接与您的服务器对话(两者之间没有Dialogflow),您需要使用Actions SDK You'll create an actions.json file which defines triggering information and the URL for a webhook. 您将创建一个actions.json文件,该文件定义触发信息和Webhook的URL。 (You can't get rid of the webhook - just change how it is called.) Your webhook will be called with JSON that has a different format from Dialogflow's JSON format, or you can use the node.js library which has a similar interface to the Dialogflow version. (您无法摆脱Webhook,只需更改其调用方式即可。)将使用与Dialogflow JSON格式不同格式的JSON来调用Webhook,或者可以使用具有类似接口的node.js库到Dialogflow版本。

Your webhook can, then, call Dialogflow using the /query endpoint (for Dialogflow V1 API) or the detectIntent message (for the Dialogflow V2 API). 然后,您的Webhook可以使用/ query端点 (对于Dialogflow V1 API)或detectIntent消息 (对于Dialogflow V2 API)调用Dialogflow。 You can send it the text from the user or an event indicating the user's action (or, really, anything you want) along with parameters and Contexts that you wish. 您可以向它发送来自用户的文本或一个事件,该事件指示用户的操作(或者,实际上,您想要执行的任何操作)以及所需的参数和上下文。 Dialogflow will send a reply, either from it's reply section or by sending it to another fulfilment webhook - whatever you choose. Dialogflow将从其答复部分发送答复,也可以将其发送到另一个实现Webhook(无论您选择什么)。

Your server will get this reply, along with any Contexts and parameters that are set. 您的服务器将收到此回复以及设置的所有上下文和参数。 It sounds like you'll send the reply to the user, probably without further processing, although you can do whatever you want. 听起来您可能会将回复发送给用户,尽管您可以做任何您想做的事情,但可能无需进一步处理。 You may want to store the context information in the conversation token , the user storage object , or in some other data store your server wishes to use. 您可能希望将上下文信息存储在会话令牌用户存储对象或服务器希望使用的某些其他数据存储中。

There are some samples for using the Actions SDK although none of them illustrate calling Dialogflow from the webhook. 尽管没有一个示例说明如何从Webhook调用Dialogflow,但仍有一些示例可以使用Actions SDK (It is not a very common pattern - most use cases work better the other way.) The samples for Dialogflow are mostly for webhooks, although the "Agent to human handoff" does illustrate sending to Dialogflow from your code. (这不是一个非常常见的模式-大多数用例都可以用其他方式更好地工作。) Dialogflow示例主要是针对Webhooks的,尽管“从人到人的代理”确实说明了从代码发送至Dialogflow。

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

相关问题 无法使用Dialogflow将我们的应用程序与Google助手集成 - can't integrate our application with Google assistant using Dialogflow 是否可以使用Google Talk中的音频聊天服务进入我的网络应用程序? - Is there away to use the Audio chat service from Google talk into my web application? 在Dialogflow上没有错误时,Google智能助理出错 - Error on Google Assistant while no error on Dialogflow 我需要在我的网络服务器上安装javascript吗? - Do I need to install javascript on my webserver? Heroku,我正在尝试将 Google2fa 添加到我的 heroku 网络服务器,但它响应 419 页面已过期 - Heroku, I'm trying to add Google2fa to my heroku Webserver but it responds with a 419 page expired 我想将Auto_Increment添加到表的第一列中 - I want to add Auto_Increment to the first column in my table 如何让我的选择框和地图脚本进行对话 - How do I get my select box and map script to talk 我想使用 docusign 在我的 Web 应用程序上签署文档 - I want to get documents signed on my web application using docusign 我想为我的 php 应用程序提供“使用 Facebook 注册”功能 - I want to have a “Sign Up with Facebook” feature for my php application 我想在我的 Laravel 应用程序中集成一个 sms api - i want to integrate a sms api on my laravel application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM