Facebook Messenger Postback Button不发送有效负载

时间:2018-05-17 21:40:16

标签: facebook facebook-messenger messenger facebook-messenger-bot

我正在使用Facebook Messenger API从页面发送消息。该消息包含一些对象,每个对象都有2个Postback按钮。按钮显示正常,点击它们也可以。但是,当我从Facebook收到回复时,它只包含title,并且缺少payload

回发按钮参考:https://developers.facebook.com/docs/messenger-platform/reference/buttons/postback

我正在向Facebook发送JSON:

 {
  "recipient": {
    "user_ref": "cf_b3TL909EpSiO45tm"
  },
  "message": {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "generic",
        "image_aspect_ratio": "horizontal",
        "elements": [
          {
            "title": "/r/business",
            "subtitle": "Bailout Swindle Revealed: Taxpayers paid $125 billion for bank stock that a private investor could purchase for $62.5 billion.",
            "image_url": "",
            "buttons": [
              {
                "type": "postback",
                "title": "Upvote",
                "payload": "34154"
              },
              {
                "type": "postback",
                "title": "Downvote",
                "payload": "34154"
              },
              {
                "type": "web_url",
                "title": "View",
                "url": "https://reddit.com//r/business/comments/7acpu/bailout_swindle_revealed_taxpayers_paid_125/"
              }
            ]
          },
          {
            "title": "/r/hiking",
            "subtitle": "Mount Marcy, Adirondacks, New York, 10/21/17 (with views of Mt Colden & MacIntyre Range)",
            "image_url": "https://i.redd.it/21569dcedltz.jpg",
            "buttons": [
              {
                "type": "postback",
                "title": "Upvote",
                "payload": "31171"
              },
              {
                "type": "postback",
                "title": "Downvote",
                "payload": "31171"
              },
              {
                "type": "web_url",
                "title": "View",
                "url": "https://reddit.com//r/hiking/comments/7885hp/mount_marcy_adirondacks_new_york_102117_with/"
              }
            ]
          }
        ]
      }
    }
  }
}

当我按下按钮时Facebook发送给我的webhook:

{
  "object": "page",
  "entry": [
    {
      "id": "2455012037857582",
      "time": 1526557553381,
      "standby": [
        {
          "recipient": {
            "id": "2455012037857582"
          },
          "timestamp": 1526557553381,
          "sender": {
            "id": "1575343315898353"
          },
          "postback": {
            "title": "Upvote"
          },
          "prior_message": {
            "source": "checkbox_plugin",
            "identifier": "cf_b3TL909EpSiO45tm"
          }
        }
      ]
    }
  ]
}

0 个答案:

没有答案