Reputation: 1105
I am trying to post an image to an Instagram account connected to my facebook account. I obtained a token using Django All auth's Facebook provider.
On checking the permissions associated with the token using Access token debugger
I got the following perissions for my token -
Scopes: email, pages_show_list, instagram_basic, instagram_content_publish, public_profile
Granular Scopes:
pages_show_list - Applies to all objects
instagram_basic - Applies to all objects
instagram_content_publish - Applies to all objects
I tried the following steps but I am not able to create an Image container to post on Instagram.
I called the accounts endpoint to get all the accounts associated with the token.
curl -i -X GET
"https://graph.facebook.com/v17.0/me/accounts?access_token=XYZ"
Use the page id from above response to get the Instagram business account id
curl -i -X GET
"https://graph.facebook.com/v17.0/<IG_USER_ID>?fields=instagram_business_account&access_token=XYZ"
Tried to create an Image container but getting an error
curl -i -X POST
"https://graph.facebook.com/v17.0/<IG_USER_ID>/media?image_url=https://images.pexels.com/photos/15925339/pexels-photo-15925339/free-photo-of-lonely-swan.jpeg&caption=#BronzFonz&access_token=XYZ"
Error -
{ "error": { "message": "Unsupported post request. Object with ID '17841......' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", "type": "GraphMethodException", "code": 100, "error_subcode": 33, "fbtrace_id": "AZEDqeP95PNePeLRooUC41e" } }
I am following the documentation here - https://developers.facebook.com/docs/instagram-api/guides/content-publishing/ Not sure where I am making a mistake.
My app is currently in dev mode and my requested permissions haven't been reviewed. I'll send for approval once my app is ready.
Upvotes: 1
Views: 3984
Reputation: 1105
I was missing a few permissions. The facebook documentation present here
doesn't mention the "pages_manage_posts" permission. So I was facing the issue because of the same. Here's the complete list of permissions I am using and I am able to create the IG image container now.
"email", "pages_show_list", "instagram_basic", "instagram_manage_comments", "instagram_content_publish", "pages_read_engagement", "pages_manage_metadata", "pages_manage_posts", "public_profile",
Upvotes: 2