Creating post with Pictures and Video via attached_media throws "Application permissions" error in FB Graph API

When creating a new FB Group post via the FB Graph API, following the instructions in FB Docs, I get Application does not have permission for this action error.

I have all the necessary permissions checked and running in a test application, all that should allow me to do pretty much what ever, as far as I understand it.

I am trying this simple call:

await axios.post(`https://graph.facebook.com/${id}/feed`,{
  attached_media: media_ids.map(media_fbid => ({ media_fbid })),
  message: post_message,
  access_token
})

And if I try it with just Pictures, it works fine, but when I add a Video file, it starts throwing the error.

This is how I get the IDs:

await Promise.all(form_data_attached_media.map(async ({ form_data, type }) => {
  const {
    data: { id: image_id } = {}
  } = await axios.post(
    `https://graph.facebook.com/${id}/${type}`, form_data
  ) // type is either photos or videos
  return media_id
}))

And it returns the ids correctly.

These are the permissions I have:

email
read_insights
publish_video
user_managed_groups
groups_show_list
pages_show_list
ads_management
business_management
instagram_basic
instagram_manage_insights
instagram_content_publish
publish_to_groups
groups_access_member_info
attribution_read
pages_read_engagement
pages_manage_metadata
pages_read_user_content
pages_manage_ads
pages_manage_posts
audience_network_placement_management
public_profile

And I am following this guide on how to attached Pictures and Videos via attached_media key:
https://developers.facebook.com/docs/workplace/reference/graph-api/group/

Is there something I am missing regarding permissions or the attached_media functionality?

Source: Ask Javascript Questions

LEAVE A COMMENT