"image_aspect_ratio" 从 Messenger BOT webview 分享时不尊重标记
"image_aspect_ratio" flag not respected while sharing from Messenger BOT webview
我正在尝试通过我的机器人的网络视图进行分享。这是我的代码
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" 标志不受尊重,图像以水平布局显示。
但同样的 JSON 在通过 CURL 完成共享时将图像显示为正方形。我的共享对象有问题吗?请帮助
您需要在负载中添加 "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"
}
]
}
]
}
}
}
这是 Messenger 平台上的错误。我向 Facebook 报告了这件事,现在它已经修复了。
https://developers.facebook.com/bugs/391245647960177/
我正在尝试通过我的机器人的网络视图进行分享。这是我的代码
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" 标志不受尊重,图像以水平布局显示。
但同样的 JSON 在通过 CURL 完成共享时将图像显示为正方形。我的共享对象有问题吗?请帮助
您需要在负载中添加 "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"
}
]
}
]
}
}
}
这是 Messenger 平台上的错误。我向 Facebook 报告了这件事,现在它已经修复了。 https://developers.facebook.com/bugs/391245647960177/