6

From Dialogflow console, i can set a custom payload like this

enter image description here

How can i send the exact same response from a webhook custom integration.

I tried sending it from Flask as JSON but it didn't work.

Brhaka
  • 1,622
  • 3
  • 11
  • 31
Wassim Seifeddine
  • 1,002
  • 12
  • 25

2 Answers2

5
{
    "fulfillmentText": "Your text response",
    "fulfillmentMessages": [
        {
            // this item is optional
            "text": {
                "text": [
                    "Your text response"
                ]
            }
        },
        {
            "payload": {
                // Your custom fields payload
            }
        }
    ]
}
  • This was the answer I was looking for! I couldn't find appropriate position for payload & wasted bunch of hours. :/ Thanks! – Joy Jun 07 '20 at 10:37
1

When you are using a webhook you have to send back a complete WebhookResponse. Unfortunately, the documentation for the webhook protocol seems to have gone missing when they migrated the documentation from dialogflow.com to cloud.google.com/dialogflow. However, it is still available in the Dialogflow Discovery document. If you look for the GoogleCloudDialogflowV2WebhookResponse there you'll see that you would have to send back something like this:

{
    "payload": {
        "facebook": {
            "attachment": {
                # ... etc.
            }
        },
        "slack": {}  # ... etc.
    }
}

The format for version v2beta1 of the Dialogflow API is the same.

gmolau
  • 2,815
  • 1
  • 22
  • 45