0
votes

I'm creating a app that publish content on instagram automatically. But, I need publish content for new users in my app, for example: A new user enter with your "username" and my application will publish a content for this new user.

In this case i got ID from account from new user in below endpoint.

https://graph.facebook.com/v10.0/business_id_from_my_dev_account/fields=business_discovery.username(<new_user_name>){username,website,name,ig_id,id}

After request, i caught businnes_id_from_new_user from response['business_discovery']['id']

When a try create a publishing container using this new user "businnes_id_from_new_user", I receive the error :

URL: https://graph.facebook.com/v10.0/**businnes_id_from_new_user**/media?access_token=<access_token>&image_url=<public_image_url>&caption=texto

Error: Unsupported post request. Object with ID 'businnes_id_from_new_user' 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.

By this error I beleave thats add permission in facebook developer page must solve, but, for each new user I have to grant manually??

Observations:

  • My new users maybe it doesn't have facebook pages.
  • In all requests i'm using the access token from business_id_from_my_dev_account

I logged in with Facebook using the javascript SDK and obtained the access token (I am simulating an end user who will use my application). In this login I used the following permissions

FB.login(function(response){
    console.log(response)
}, {scope: 'public_profile,ads_management,business_management,instagram_basic,instagram_content_publish,pages_read_engagement,manage_pages,pages_show_list'});

The login worked correctly and I accepted the permissions through the facebook page. However when I try to get the facebook page ID for this user (using his access token) I get an empty response.

GET: https://graph.facebook.com/v10.0/me/accounts?access_token=<token_from_new_user>

Response: {
    "data": []
}

Can anyone tell me why I am getting an empty answer?

Note: The logged in user already has a Facebook page and permissions have already been enabled.

1
What permissions did you ask from the user? Did you ask for any? Did you even make them actually login to your app in the first place? Or did you think, you could publish based on just the fact that you got the account ID from the Business Discovery endpoint?CBroe
I believe it is this part that I am doing wrong (trying to make publications only with the new user's business_id). I imagine that I have to ask for some kind of permission, but I did not find a clear flow in the documentation that shows me what I must do to run automatic publications for a new user registered in my application.Igor Rodrigues
I still haven't been able to ask for permission. I'm trying to request permissions and get a valid token via login via url: api.instagram.com/oauth/… However, after successful login, I always get the error: invalid redirect_uri and I’ve already tested different types of redirect URIs: - localhost:8000 - socialsizzle.herokuapp.com/auth - google.com I tested it with and without the bar at the end.Igor Rodrigues
I really don't know if this is the right way for me to get the new user's permissions and publish via the graph API.Igor Rodrigues
I think you are using the wrong login endpoint there to begin with - api.instagram.com/oauth is for the IG Basic Display API. You need to implement Facebook login - developers.facebook.com/docs/instagram-api/getting-startedCBroe

1 Answers

0
votes

At this time you can only use Content Publishing API for publishing to IG Business Accounts, you cannot publish to non-Business accounts. IG Business Account means it will be backed by a Facebook Page.

You would get the IG Business Account ID from GET /{page-id}?fields=instagram_business_account using a Page Access Token.

I'd recommend reviewing the requirements section in https://developers.facebook.com/docs/instagram-api/guides/content-publishing/

If you think your app is setup correctly you can submit a bug report at https://developers.facebook.com/support/bugs/create and the team there will be able to inspect your App and Access Token