简体   繁体   English

如何将聊天机器人 webhook 与基于网络的聊天 window 集成?

[英]How to integrate a chatbot webhook with a web-based chat window?

I want to develop a web-based chat conversation.我想开发一个基于网络的聊天对话。 I have a Dialogflow webhook that is up and running and that can be easily integrated with, say, facebook messenger or whatsapp, thanks to the functionalities of Dialogflow itself.由于 Dialogflow 本身的功能,我有一个已启动并正在运行的 Dialogflow webhook,并且可以轻松地与 facebook Messenger 或 whatsapp 集成。

Now, say I want to have a web-based chat plugin that I want to interact with said Dialogflow webhook.现在,假设我想要一个基于 Web 的聊天插件,我想与所说的 Dialogflow webhook 进行交互。 How does that work, in terms of setup?就设置而言,它是如何工作的? There are things I know I need, I would like your help to identify things that are still missing and to help me put them all together (conceptually).有些东西我知道我需要,我希望你能帮助我找出仍然缺少的东西,并帮助我把它们放在一起(从概念上)。

  • I need something to make the chat conversation look pretty;我需要一些东西来让聊天对话看起来很漂亮; I was hoping there would be some chat plugin online to style messages but the things I could find are always more complicated than that and have functionalities for you to set messages for the plugin to send automatically and things like that.我希望有一些在线聊天插件来设置消息的样式,但我能找到的东西总是比这更复杂,并且有功能让你为插件设置消息以自动发送等等。
  • I need something that is triggered when the user sends a message;我需要在用户发送消息时触发的东西 when the user sends a message I need to send it to Dialogflow in order to have it fulfilled.当用户发送消息时,我需要将其发送到 Dialogflow 以实现它。 Can this be done directly from JS?这可以直接从JS完成吗? Or do I have to send some request to my server, which will then call Dialogflow and return the user message?还是我必须向我的服务器发送一些请求,然后它会调用 Dialogflow 并返回用户消息?

Is this all I need?这就是我所需要的吗? I am sorry if this question is too confusing or broad, I'll be glad to give further clarifications as needed.如果这个问题太混乱或太宽泛,我很抱歉,我很乐意根据需要提供进一步的说明。

I think you need this.我想你需要这个。

https://cloud.google.com/dialogflow/docs/quick/api#detect-intent-text-nodejs https://cloud.google.com/dialogflow/docs/quick/api#detect-intent-text-nodejs

When you use the API for interactions, your service interacts directly with the end-user.当您使用 API 进行交互时,您的服务会直接与最终用户进行交互。 For each conversational turn, your service sends end-user expressions to Dialogflow by calling the detectIntent or streamingDetectIntent method of the Sessions type.对于每个会话轮次,您的服务通过调用Sessions类型的detectIntentstreamingDetectIntent方法将最终用户表达式发送到 Dialogflow。 Dialogflow responds with information about the matched intent, the action, the parameters, and the response defined for the intent. Dialogflow 使用有关匹配的意图、操作、参数和为该意图定义的响应的信息进行响应。 Your service performs actions as needed (for example, database queries or external API calls) and sends a message to the end-user.您的服务根据需要执行操作(例如,数据库查询或外部 API 调用)并向最终用户发送消息。

It just API interaction with your chat client, you can design the way you want.它只是 API 与您的聊天客户端交互,您可以设计您想要的方式。

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

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