I’m trying to create post in FB group with video content using FB Graph API.
First issue – I send video (POST ‘<group_id>/videos’) with option "published: false" but video is published (published: false works for photos)
Second issue – I got permission error when I’m trying to create post with video
const FB = require('fb');
media = await FB.api(`/${process.env.FB_GROUP_ID}/videos`, 'POST',
{
file_url: image.video_url,
published: false,
no_story: true,
},
);
media1 = await FB.api(`/${process.env.FB_GROUP_ID}/photos`, 'POST',
{
url: image.image_url,
published: false,
},
);
const { id } = await FB.api(`/${process.env.FB_GROUP_ID}/feed`, 'POST',
{ message: "Hello world!!!", attached_media: [{ media_fbid: media.id}, { media_fbid: media1.id}] },
);
Facebook debug information:
==== Query
curl -i -X POST
"https://graph.facebook.com/v14.0/276211843876262/feed?message=G%20g%20g%20g%20g%20g%20g%20g%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20r%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20r%20t%20t%20r%20r%20r%20r%20r%20r%20r&attached_media=%5B%0A%20%20%7B%0A%20%20%20%20%22media_fbid%22%3A%20%221216999835778498%22%0A%20%20%7D%0A%5D&access_token=<access token sanitized>"
==== Access Token Info
{
"perms": [
"user_photos",
"user_videos",
"user_posts",
"publish_video",
"catalog_management",
"user_managed_groups",
"groups_show_list",
"pages_show_list",
"publish_to_groups",
"groups_access_member_info",
"pages_read_engagement",
"pages_manage_metadata",
"pages_read_user_content",
"pages_manage_posts",
"pages_manage_engagement",
"public_profile"
],
"user_id": <user id>,
"app_id": <app id>
}
==== Parameters
- Query Parameters
{}
- POST Parameters
{
"message": "G g g g g g g g t t t t t t t t t t t t t t t t t r t t t t t t t t t t t t t t t t t t r t t r r r r r r r",
"attached_media": "[n {n "media_fbid": "1216999835778498"n }n]"
}
==== Response
{
"error": {
"message": "(#10) Application does not have permission for this action",
"type": "OAuthException",
"code": 10,
"fbtrace_id": "AFiARMOWvZfM9GCSmTCMFcl"
}
}
==== Debug Information from Graph API Explorer
- https://developers.facebook.com/tools/explorer/?method=POST&path=276211843876262%2Ffeed&version=v14.0&message=G%20g%20g%20g%20g%20g%20g%20g%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20r%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20t%20r%20t%20t%20r%20r%20r%20r%20r%20r%20r&attached_media=[%0A%20%20%7B%0A%20%20%20%20%22media_fbid%22%3A%20%221216999835778498%22%0A%20%20%7D%0A]
2
Answers
Posting a video works different than posting images, you don’t need the 2nd call, simply modify your 1st call and remove the no_story=true and published=false, and add "description" (the message field on the feed) and "title" and it will work
Any news on this?
Video gets posted but returns a
media_id
which isn’t sufficient if I want to add a comment to that post via API.