Posts tagged with facebook-graph-api

I have created a whatsapp app with catalog integration. When a user places an order the product details are fetched using

url = f"https://graph.facebook.com/v19.0/{product_catalog_id}/products" params = {     "fields": '["category","name","description"]',     'filter': f'{{"retailer_id": {{"i_contains": "{retailer_id}"}}}}',     "summary": "false",     "access_token": access_token } 

It works when I am running it using ngrok, but when I use aapanel, for some reason, this same script returns null there. I have tried hardcoding the value of product_catalog_id to test if thats the issue. But nothing works, and its also not throwing any error. What could be the reason? Am I lacking any permissions?

I am trying out the Instagram Graph API for the first time to get the user page ID, aiming to retrieve the Instagram business account ID. However, when I use the Graph tool for my app and enter me/accounts, it returns nothing. I read that me/accounts should return various data, including what I need, but it comes up empty despite fetching the access token properly.

I've had trouble finding updated documentation on the correct permissions needed for me/accounts. Some permissions don't seem to be available anymore. I've tried many permissions, but nothing works. Currently, I have the following permissions: pages_show_list, instagram_basic, instagram_manage_comments, instagram_manage_insights, pages_read_engagement, pages_manage_metadata, and pages_read_user_content. I also have a business Instagram account linked to my Facebook account.

Any advice on how to sort it?

I tried using graph apis and even in meta explore tools as well, but getting data as empty string on fteching me/accounts. I had linked instagram and facebook page and even turned instagram account into business account. Expecting to get all the accounts linked, so that i can use id for content publishing.

I have two function. One is responsible for creating audience for the engaged page of Facebook and the other is for creating a custom audience for Instagram business account. I am using step functions to call my lambdas function. But whenever I try to create audience of Facebook and Instagram simultaneously, so I received an error of permission

No permission on event source: You do not have permission to create an audience on one or more event sources

But when I try to create a single audience for example just only for Facebook or just only for Instagram there is no error for the permissions but when I try to create audience simultaneously for the Facebook and for the Instagram business account I got this error

const createSocialAudience = async ({     name,     pageId,     adsAccountId,   } ) => {     if (!name || !adsAccountId || !pageId) {       throw new Error('Marketing API call missing required params');     }     const requestData = {       name,       description: 'Recent page visitors (from 360 days) visiting given page',       rule: {         inclusions: {           operator: 'or',           rules: [             {               event_sources: [                 {                   type: "page",                   id: pageId,                 },               ],               retention_seconds: 60* 60* 24 * 360,               filter: {                 operator: 'and',                 filters: [                   {                     field: 'event',                     operator: 'eq',                     value: 'page_engaged',                   },                 ],               },             },           ],         },       },       access_token: params.marketingApiToken,     };     const { data } = await httpClient.post(       `https://graph.facebook.com/v19.0/act_${adsAccountId}/customaudiences`,       JSON.stringify(requestData)     );     return data;   };   const createInstagramAudience = async ({     name,     igUserId,     adsAccountId,   })  => {     if (!name || !adsAccountId || !igUserId) {       throw new Error('Marketing API call missing required params');     }     const requestData = {       name,       description: 'Recent page visitors (from 360 days) visiting given page',       rule: {         inclusions: {           operator: 'or',           rules: [             {               event_sources: [                 {                   type: 'ig_business',                   id: igUserId,                 },               ],               retention_seconds: 60 *60 * 24 * 360,               filter: {                 operator: 'and',                 filters: [                   {                     field: 'event',                     operator: 'eq',                     value: 'ig_business_profile_engaged',                   },                 ],               },             },           ],         },       },       access_token: params.marketingApiToken,     };     const { data } = await httpClient.post(       `https://graph.facebook.com/v19.0/act_${adsAccountId}/customaudiences`,       JSON.stringify(requestData)     );     return data;   }; 

Expecting to create both of my audience at the same time for example I want two type of event_sources one for page of Facebook and one for ig_business

I am creating facebook video ads with google app script, for this first I have to upload video with this endpoint: "https://graph-video.facebook.com/v19.0/pageId/videos". complete code function is this:

function uploadVideoChunk(pageId, uploadSessionId, startOffset, videoChunk) {     //return uploadFileFetch(pageId, uploadSessionId, startOffset, videoChunk)     var url = "https://graph-video.facebook.com/v19.0/" + pageId + "/videos";     var payload = {       "upload_phase": "transfer",       "access_token": page_access_token,       "upload_session_id": uploadSessionId,       "start_offset": startOffset,       "video_file_chunk": videoChunk     };     var options = {       "method": "POST",       "payload": payload,       "muteHttpExceptions": true     };     var response = UrlFetchApp.fetch(url, options);     var responseData = JSON.parse(response.getContentText());     console.log('upload Video Chunk responseData = ',responseData)     var newStartOffset = responseData.start_offset;          return newStartOffset; } 

I am getting this error: Your video upload timed out before it could be completed. This is probably because of a slow network connection or because the video you're trying to upload is too large. Please try again

could you please help how can I solve this.

Thank you

I am following this: https://developers.facebook.com/docs/video-api/guides/publishing/#step-2--upload-chunks-individually

  1. I have created the app.
  2. I used the short-lived user access token to get a long-lived user access token.
  3. Then I tried to exchange the long-lived user access token for a long-lived page access token.
  4. This is the response I am getting:
    {      "error": {         "message": "(#15) This method must be called with an app access_token.",         "type": "OAuthException",         "code": 15,         "fbtrace_id": "AaKKgfwJzZsNDXADht1N7wy"      }     } 
  1. This is the endpoint for the API call to receive a long-lived page access token:
https://graph.facebook.com/v19.0/{app-id}/accounts?access_token={long-lived-user-access-token} 
  1. The endpoint for long-lived user access token:
https://graph.facebook.com/v19.0/oauth/access_token?grant_type=fb_exchange_token&client_id={app-id}&client_secret={app-secret}&fb_exchange_token={short-lived-user-access-token} 
  1. According to this documentation, I need to exchange a long-lived user access token in order to get a long-lived pages access token: Facebook Developer Documentation