Exo*_*mus 2 facebook facebook-graph-api
当我将图像附加到页面帖子时,我不断收到此错误消息
message: '(#10) Application does not have permission for this action'
Run Code Online (Sandbox Code Playgroud)
但当我只发布消息时,它工作正常
FB.api('PAGE_ID/feed', 'post', {
message: 'Message is here',
link: 'https://my_LINK.com',
"child_attachments": [
{
"link": "https://1.jpg",
"image_hash": "hash1",
"name": "Some Name",
"description": "Some description"
},
{
"link": "https://2.jpg",
"image_hash": "hash2",
"name": "Some Name",
"description": "Some description 2"
}]
}, function (res) {
if (!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
return;
}
});
Run Code Online (Sandbox Code Playgroud)
要将多图像添加到 Facebook 的帖子中,必须按照Facebook分 2 个步骤完成
要上传图片,请参阅此内容并发布帖子
function post_fb_ad(description, ad_images) {
attached_media = []
for (var adImg of ad_images) {
attached_media.push({ media_fbid: adImg.id })
}
FB.api('page_id/feed', 'post', {
message: description,
attached_media: attached_media,
access_token: EXD_ACCESS_TOKEN
}, function (res) {
if (!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
return;
}
console.log('post id is ', res)
});
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1867 次 |
| 最近记录: |