skip to Main Content

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

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.

Visually :

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

User : ====> Send file 

** 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"
  }
}

Thus, I expect :

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 ***

BUT, I have :

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

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

2

Answers


  1. A full description of what you are using can be found here Invoke event from webhook. The documentation is pretty detailed on what to expect. Explicitly, when you return a populated followupEventInput from your webhook call, any speech, display text or other data fields are not passed on to the newly initiated intent. It is the response from that newly initiated intent which is sent to the user.

    To achieve what you want, perhaps create a new intent that contains the complete content of what you want to send to the user.

    Another possibility would be to allow an optional parameter to be supplied to your final intent and return that in the response to the user. For example, a response of:

    ${optionalSpeech} Do this this and this.
    

    would return:

    Do this this and this
    

    if the optionalSpeech were empty but would return

    Here is my optional speech.  Do this this and this.
    

    If your followupEventIntent passed in a value of “Here is my optional speech.” in the optionalSpeech parameter of a followupEventInput.

    Login or Signup to reply.
  2. 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.

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

    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.”

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search