Postback buttons

Updated 1 month ago by Matthew Clementson

Postback buttons allow the webhook to create a small menu of phrases that the user can choose as the next line of the conversation with the chatbot.

When using postback type buttons, there are two fields that need to be populated apart from the button type. The title field is the content that the user will see displayed on the button. The payload field is the data that be sent back to the chatbot.

Here's an example of a webhook response that creates a simple button template with three options.

{
             "text":"What do you want to know?",
             "facebook":{
                "attachment":{
                   "type":"template",
                   "payload":{
                      "text":"What do you want to know?",
                      "buttons":[
                         {
                            "title":"About me",
                            "payload":"what is your name",
                            "type":"postback"
                         },
                         {
                            "title":"The weather",
                            "payload":"weather in london today",
                            "type":"postback"
                         },
                         {
                            "title":"A joke",
                            "payload":"joke",
                            "type":"postback"
                         }
                      ],
                      "template_type":"button"
                   }
                }
             }
          }
          


Here's what the template code above looks like:


How did we do?