tText并通过followupEventInput转移到另一个

tText并通过followupEventInput转移到另一个

本文介绍了发送fulfillmentText并通过followupEventInput转移到另一个意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Python / Flask建立了一个简单的webhook,以处理各种Dialogflow完整文件。在这一点上,一切工作都很好。该机器人已通过DialogFlow的API V2与Facebook Messenger集成

I've set up a simple webhook with Python/Flask to deal with various Dialogflow fullfilments. Everything is working quite well on that point. The bot is integrated to Facebook Messenger with API V2 of DialogFlow

问题是,就我的Webhook逻辑的输出而言,我想吸引用户一个意图或另一个意图(例如,将其返回到解释意图或类似意图)。我知道我可以做到这一点,这要归功于 followupEventInput的概念。触发工作正常。但是,问题是我想在移动用户之前显示一个文本,因此我将一个文本定义为 fulfillmentText,但是在将用户发送到触发的意图之前,该文本不会显示。

The problem is that, in regards of the output of my webhook logic, I want to "bring" my user to an intent or another (for example, bring it back to an explanation intent or something similar). I understood that I can do that thanks to concept of "followupEventInput". The triggering works so that's OK. BUT, the thing is that I want to display a text before moving the user so I define one into "fulfillmentText" but this one doesn't show up before the user is sent to the triggered intent.

视觉上:

User : Hello
Bot : Hello
User : I want to send a picture
Bot : Okay ! Do it like that ... and like that

User : ====> Send file

** Webhook触发**并应用逻辑。它不是图像文件,因此我发送包含以下内容的响应:

** Webhook triggered ** and apply logic. It's not an image file so I send a response which contains :

{
  'fulfillmentText': "You haven't send a image.. I bring you back to the explanations ",
  'followupEventInput': {
    "name": "Event_That_Trigger_Explanations"
  }
}

因此,我希望:

User : ====> Send file
**Webhook magic**
Bot : You haven't send a image.. I bring you back to the explanations
Bot : Okay ! Do it like that ... and like that ***

但是,我有:

User : ====> Send file
**Webhook magic**
Bot : Okay ! Do it like that ... and like that ***

非常感谢您的帮助!我想我对Dialogflow有误解:P

Thank you very much for your help ! I guess I misunderstand something in Dialogflow :P

推荐答案

了解Intent的关键点在于它们捕获了用户说或做,而不是您要做什么。因此,说您先回答某件事然后触发另一个Intent并没有任何意义。

The key point to understand about Intents is that they capture what the user says or does and not what you do with that. So it doesn't make sense to say that you reply with something and then "trigger" another Intent.

首先,发送 followupEventInput 表示将忽略任何其他答复。

First, sending followupEventInput means that any other reply is ignored.

但是,更重要的是,由于您使用的是Webhook,因此您只需发送回想要发送的内容即可。因此,在您的Webhook中,您可以发送答复:您尚未发送图像。您可以那样做。

More importantly, however, since you're using a webhook you can just send back what you want to send. So in your webhook, you can just send the reply: "You haven't sent an image. You can do it like that or like that."

这篇关于发送fulfillmentText并通过followupEventInput转移到另一个意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 12:06