【问题标题】:"image_aspect_ratio" flag not respected while sharing from Messenger BOT webview从 Messenger BOT webview 共享时不遵守“image_aspect_ratio”标志
【发布时间】:2017-10-21 15:20:57
【问题描述】:

我正在尝试从我的机​​器人的网络视图中进行分享。这是我的代码

var messageToShare = {
            "attachment":{
              "type":"template",
              "payload":{
                "template_type":"generic",
                "image_aspect_ratio":"square",
                "elements":[
                   {
                    "title":"Welcome to Peter\'s Hats",
                    "subtitle":"We\'ve got the right hat for everyone.",
                    "image_url":"https://pbs.twimg.com/profile_images/735453447718338561/9W-MTtOo_400x400.jpg",
                    "buttons":[
                      {
                        "type":"web_url",
                        "url": "my share url",
                        "title":"View Website"
                      }
                    ]
                  }
                ]
              }
            }
        }
MessengerExtensions.beginShareFlow(
  function success() {},
  function error(errorCode, errorMessage) {},
  messageToShare,
  "broadcast"
);

共享工作正常,但未按预期发布图像。不考虑“image_aspect_ratio”标志,图像以水平布局显示。

但是当通过 CURL 完成共享时,相同的 JSON 将图像显示为正方形。我的共享对象有问题吗?请帮忙

【问题讨论】:

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


    【解决方案1】:

    这是 Messenger 平台上的一个错误。我向 Facebook 报告了这件事,现在它已被修复。 https://developers.facebook.com/bugs/391245647960177/

    【讨论】:

      【解决方案2】:

      您需要在有效负载中添加"sharable":true

      var messageToShare = {
        "attachment":{
          "type":"template",
          "payload":{
            "template_type":"generic",
            "image_aspect_ratio":"square",
            "sharable": true,
            "elements":[
               {
                "title":"Welcome to Peter\'s Hats",
                "subtitle":"We\'ve got the right hat for everyone.",
                "image_url":"https://pbs.twimg.com/profile_images/735453447718338561/9W-MTtOo_400x400.jpg",
                "buttons":[
                  {
                    "type":"web_url",
                    "url": "my share url",
                    "title":"View Website"
                  }
                ]
              }
            ]
          }
        }
      }
      

      【讨论】:

        猜你喜欢
        • 2017-09-04
        • 2023-03-24
        • 1970-01-01
        • 2017-02-05
        • 2017-08-22
        • 2021-01-22
        • 2017-10-05
        • 2018-12-03
        • 1970-01-01
        相关资源
        最近更新 更多