Search code examples
facebook-messenger-botdialogflow-es

Dialogflow V2 Messenger Integration with Multiple Messages


I am trying to send to multiple messages within one Webhook call to Dialogflow, which shall be passed to Messenger. Right now my Webhook responds with a malfunctioning JSON body:

{
    'fulfillmentText': "Text",
    'fulfillmentMessages': [{
        "platform": "facebook",
        "text": [{
            "text": "Text"
        }]
    }],
    'source': "facebook"
}

When I test the Webhook via Messenger I see the is typing symbol, but never receive the Text message. While testing the same Webhook from the Dialogflow Console I get

Webhook execution successful

returned. I guess I am missing some JSON fields to tell Dialogflow in which format it has to send the JSON two the Messenger API. Anybody having any clues on how to solve this issue?


Edit: My latest not working trial...

{
  "fulfillmentText": "Hola!",
  "fulfillmentMessages": [
    {
      "text": {
        "text": [
          "Title: this is a title"
        ]
      },
      "platform": "FACEBOOK"
    },
    {
      "text": {
        "text": [
          "Title: this is a title"
        ]
      },
      "platform": "FACEBOOK"
    }
  ]
}

Solution

  • I mailed the Dialogflow support about this issue and it turns out that it is currently not possible to send multiple messages from a webhook.

    Hi,

    At this point, it's not possible to send sequential messages directly from webhook. However, if you are using one of our one-click integrations that support rich messages, you can invoke intents in which multiple messages are defined from webhook through an event as described at https://dialogflow.com/docs/events#invoking_event_from_webhook.

    Let me know if you have any questions.

    Regards, Ankita from Dialogflow