Posts tagged with facebook-graph-api

am working with the Instagram Graph API to retrieve Instagram followers count for accounts linked to Facebook Pages. I am using the following scopes: instagram_basic and pages_show_list.

While the API works for some Facebook accounts and returns the Instagram followers count correctly, it does not work for other accounts, even though those accounts have Instagram Business or Creator accounts linked to their Facebook Pages.

Here’s an outline of my setup:

I use the endpoint GET /{page_id}?fields=instagram_business_account to fetch the Instagram Business Account ID. Once I have the Instagram Business Account ID, I query GET /{instagram_account_id}?fields=followers_count to get the followers count. For some Facebook Pages, the instagram_business_account field is returned as null, even though the Instagram accounts are properly linked to the Facebook Pages.

I have ensured:

The access token has the required permissions (instagram_basic, pages_show_list). The user token is generated correctly, and the app is authorized for all required permissions. The Instagram accounts in question are Business or Creator accounts and linked correctly to the Facebook Pages.

Has anyone faced a similar issue? Are there additional permissions or configurations needed to consistently fetch the Instagram Business Account ID and followers count?

Any guidance or insights would be appreciated!

Thank you.

I'm facing an issue with the Instagram Graph API where the ID in the webhook data doesn't match the ID returned from the /me endpoint.

I use the /me endpoint to get the Instagram Business ID:

https://graph.instagram.com/me?fields=id,username

This returns 12345 and my username.

When an Instagram user sends a message, the webhook data contains a different recipient ID (67890), which doesn't match the stored ID (12345).

Example Webhook:

{   "object": "instagram",   "entry": [     {       "time": 67890,       "id": "12345400796128930",       "messaging": [         {           "sender": { "id": "981149143905198" },           "recipient": { "id": "67890" },           "timestamp": 1735516966810,           "message": {             "mid": "1bfkwjeb1jk43b1jk43bkj",             "text": "hello hello"           }         }       ]     }   ] } 

The recipient ID (67890) corresponds to the user who authorized my app but is not the same as the ID from the /me endpoint.

Is Instagram sending an ID that can't be looked up via the access token? This ID (67890) is persistent across multiple webhook requests.

I want to create an API to basically call conversion API based on the

  1. to user access token through embedded signup
  2. manually select event type
  3. get the pages which the user will select through the access token the above are all working properly, but now I also want to get the pixels based on the page selected so I have the page id, access_token but I am unable to get any API that gives me the pixels as per the page.

I have tried:

  1. https://graph.facebook.com/v21.0/me/adaccounts?fields=business_name,name,account_status,balance,currency,adspixels{name,code},amount_spent,min_daily_budget,insights&access_token=

    But it returns me: Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api"

  2. https://graph.facebook.com/v21.0/ad_account_id/adspixels

    but in this I have manually added the ad account id and it still didn't work, but I want to be able to call it dynamically.