CX Webhook response as custom payloads

3,316 views
Skip to first unread message

Nandan Thakur

unread,
Apr 14, 2022, 4:07:43 PM4/14/22
to Dialogflow CX Edition users
Why my webhook payloads not showing as buttons?
the object I'm sending from webhook: 
{
    fulfillment_response: {
        messages: [
          {
            text: {
              ////fulfillment text response to be sent to the agent
              text: [
                "Please select anyone"
              ]
            }
          }
        ]
      },
    payload:{
  "richContent": [
    [
      {
        "type": "chips",
        "options": [
          {
            "text": "Chip 1",
            "image": {
              "src": {
                "rawUrl": "https://example.com/images/logo.png"
              }
            },
            "link": "https://example.com"
          },
          {
            "text": "Chip 2",
            "image": {
              "src": {
                "rawUrl": "https://example.com/images/logo.png"
              }
            },
            "link": "https://example.com"
          }
        ]
      }
    ]
  ]
}
}

the response I am getting in dialog flow cx.

webhookresp.PNG

Dilpreet Kaur

unread,
Apr 15, 2022, 5:47:07 PM4/15/22
to Dialogflow CX Edition users

Saurav Nair

unread,
Apr 20, 2022, 12:55:58 PM4/20/22
to Dialogflow CX Edition users
Hey Nandan,

The reason you not seeing the payload is because it's being set as a webhook payload rather than a custom payload. In order to display a rich response, you need to populate the custom payload with the appropriate JSON body.

i.e. You need to populate the payload field inside of the messages array of fulfillment_response.
{
   "fulfillment_response":{
      "messages":[
         {

            "text":{
               :[
                  "Please select anyone"
               ]
            },
            "payload":{
               "richContent":[
                  [
                     {
                        "type":"chips",
                        "options":[
                           {
                              "text":"Chip 1",
                              "image":{
                                 "src":{
                                    "rawUrl":"https://example.com/images/logo.png"
                                 }
                              },
                              "link":"https://example.com"
                           },
                           {
                              "text":"Chip 2",
                              "image":{
                                 "src":{
                                    "rawUrl":"https://example.com/images/logo.png"
                                 }
                              },
                              "link":"https://example.com"
                           }
                        ]
                     }
                  ]
               ]
            }
         }
      ]
   }
}

This should let you see the payload inside the test simulator, but in order to actually see the rich response buttons, you need to enable the df messenger integration and then try it out.
Reply all
Reply to author
Forward
0 new messages