文档已更新。
中文(简体) 译文尚未完成。
英语更新时间:6月26日
中文(简体) 更新时间:2018年2月23日

Postback Button Reference

When the postback button is tapped, the Messenger Platform sends an event to your postback webhook. This is useful when you want to invoke an action in your bot. This button can be used with the Button Template and Generic Template.

For more information on using the postback button, see Postback Button.

Postback Overview

When the postback button is tapped, the Messenger Platform sends an event to your postback webhook. This is useful when you want to invoke an action in your bot. This button can be used with the Button Template and Generic Template.

For more information on using the postback button, see Postback Button.

Postback Button Syntax

{
  "type":"postback",
  "title":"<BUTTON_TEXT>",
  "payload":"<DEVELOPER_DEFINED_PAYLOAD>"
}

Postback Example Usage

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"<PSID>"
  },
  "message":{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"button",
        "text":"Try the postback button!",
        "buttons":[
          {
            "type":"postback",
            "title":"Postback Button",
            "payload":"DEVELOPER_DEFINED_PAYLOAD"
          }
        ]
      }
    }
  }
}' "https://graph.facebook.com/v21.0/me/messages?access_token=<PAGE_ACCESS_TOKEN>"

c:curl>

Postback Example Response

{
  "recipient_id": "1254477777772919",
  "message_id": "AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdCK48PnKAjSdjfipqxqMvK8ma6AC8fplwlqLP_5cgXIbu7I3rBN0P"
}  

Postback Properties

Property Type Description

type

String

Type of button. Must be postback.

title

String

Button title. 20 character limit.

payload

String

This data will be sent back to your webhook. 1000 character limit.