Posts under category Meta & Facebook

My app is registered on facebook and has been live since the past 2 years. Now, i switched it to development mode since i need to integrate with "Instagram API with Facebook login".

So after following the documentation, https://developers.facebook.com/docs/instagram-platform/instagram-api-with-facebook-login/business-login-for-instagram , i linked my insta business account to one of my facebook pages using this link https://www.facebook.com/business/help/connect-instagram-to-page (Note : My facebook account has 2 pages)

I also linked the fb account to insta account by following this : https://help.instagram.com/176235449218188

I have added instagram under products section in my registered app in facebook. I have not confgured anything with respect to "API Setup with facebook login" there.

Now, iam trying to access /me/accounts to get all the pages data and instagram business account id by including scopes "instagram_basic" and "instagram_content_publish"

But iam not getting any data in graph API tool. It just returns

{   "data": [   ] } 

I have tried to debug, but couldnt figure it out. Iam stuck at this point. Any help would be appreciated,thanks.

Can not upload video file node.js to facebook graph api version v21,0 and error is video file not supported

I am Creating a ecommerce what will be able to post facebook the video events of the website .

and I am using facebook graph api version v21.0

for generating session id , I use

//FACEBOOK_GRAPH_API=https://graph.facebook.com //FACEBOOK_GRAPH_VERSION=v21.0 async function initInializeVideoUploadSession({file_name,file_length,file_type,access_token}) {     let url =makeUrlWithParams(`${FACEBOOK_GRAPH_API}/${FACEBOOK_GRAPH_VERSION}/${FACEBOOK_APP_ID}/uploads`,{         file_name,         file_length,         file_type,         access_token     });     log({url})     let res=await fetch(url, {         method :'POST'     });     res=await res.json();     if (!res.id) {         console.log(res);         throw 'Can not facebook token'     }     return res.id } 

for generating the file handle

 //FACEBOOK_GRAPH_API=https://graph.facebook.com //FACEBOOK_GRAPH_VERSION=v21.0 async function uploadAVideoFile(options) {     let prom= new Promise( async(resolve, reject) => {         let {             session,             access_token,             videoPath,             filename         }=options         let url =makeUrlWithParams(`${FACEBOOK_GRAPH_API}/${FACEBOOK_GRAPH_VERSION}/${session}`,{})         log({url})         request(url , {             method :'POST',              headers :{                 'Authorization':'OAuth '+access_token,                 'file_offset' :'0',                 'accapt':"video/mp4",                 'cache-control': 'no-cache',                 'content-type' : 'video/mp4',                 'content-disposition': 'attachment; filename=' + filename,                 'content-length':fs.statSync(videoPath).size.toString()             },             body :fs.readFileSync(videoPath,'binary'),             encoding :null         },responseCallBack)         function responseCallBack(error , response, data) {             data=JSON.parse(data);             log(data)             if (data.h) return resolve(data.h)             if (!data.h) {                 throw new Error('File Handler is not define')             }         }     })     let h=await prom.then(h => h)     return h    } 

By facebook api, I can generate session id ,file handle ,

but when I am using this file handle to post a video on facebook page i am getting error ,video format not supported,please see the upload video code

 async function videoFacebookApi(req,res) {     let {title,description,filename}=req.body;       try {         if (typeof title        !==  'string' ) throw 'title is null'         if (typeof description  !==  'string' ) throw 'description is null'         if (typeof filename     !==  'string' ) throw 'filename is null'         let access_token = await settingsAsString('fb_access_token');         let tokenDate    = await settingsAsString('fb_access_token_enroll_date');         if ( !access_token || !tokenDate) {             throw new Error('!FV_PAGE_ACCESS_TOKEN || !tokenDate')         }         updateFacebookApiAccessToken(tokenDate);         let videoPath=resolve(dirname(fileURLToPath(import.meta.url)), '../../../public/video/Beauty.mp4');                          log('// file upload session started')         let session=await initInializeVideoUploadSession({             file_name:filename,             file_length:fs.statSync(videoPath).size,             file_type:"video/mp4",             access_token         });         log('// file uploading started')         let file_handle= await uploadAVideoFile({             session,             access_token,             videoPath,             filename,             });         log('// video post started')         await request.post(makeUrlWithParams('https://graph-video.facebook.com'+'/'+FACEBOOK_GRAPH_VERSION+'/'+FB_PAGE_ID+'/videos',{}),             {             headers :{                 "Content-Type": "multipart/form-data",                 "accept": "*/*"             },             formData :{                 title,                 description,                 access_token,                 fbuploader_video_file_chunk:file_handle             }         }, uploadToFacebook );         async function uploadToFacebook(error, response, body) {             try {                     if (error) {                     console.error(error)                     return res.sendStatus(500)                 }                 if (body) {                     body=await JSON.parse(body)                     if (body.id) {                         console.log({body});                         console.log('//video upload completed');                                                  return res.sendStatus(201)                     }                     if (body.error) {                         console.error({...body.error});                         return res.sendStatus(400)                     }                     console.log({body});                     return res.sendStatus(200)                 }                 return res.sendStatus(200)             } catch (error) {                 console.log({error});                 return res.sendStatus(500)             }           }     } catch (error) {         log({error})         return res.sendStatus(500)     } } 

Please see the error carefully

{   message: "The video file you selected is in a format that we don't support.",   type: 'OAuthException',   code: 352,   error_subcode: 1363024,   is_transient: false,   error_user_title: 'Unsupported Video Format',   error_user_msg: "The video you're trying to upload is in a format that isn't supported. Please try again with a video in a supported format.",    fbtrace_id: 'ASMNMrVVh4jeY06_nDP_y9d' } 

then docomentation I am following for this functionality is facebook graph api docomentation

I'm using the Instagram Graph API via https://graph.facebook.com/v21.0 to publish both images and videos on Instagram. Publishing images works without issues, but I'm encountering a problem when attempting to publish videos.

Here’s my process:

1. Create Media Container for Video

I create a media container using the following request:

POST https://graph.facebook.com/v21.0/<user-id>/media {    video_url: video.mp4 (744k, 18s long H264 MPEG-4 AAC)    caption: caption    media_type: REELS    share_to_feed: true    access_token: ... } 

2. Publish Media Using the Container ID Then, I attempt to publish the video with this request:

POST https://graph.facebook.com/v21.0/<user-id>/media {     creation_id: <id-container>     access_token: ... } 

However, this returns a 500 error:

{     "error": {         "message": "An unknown error has occurred.",         "type": "OAuthException",         "code": 1,         "fbtrace_id": <trace-id>     } } 

I can't find anything on the community forum and the bug report is not working either. Any idea what I could try?

In my iOS swift application I have implemented a Facebook Sign-in. It worked perfectly. But recently when user try to login it is not redirecting to app after user successfully login. Its stuck in the below view. After click cancel it will call to Login method with fbloginresult.isCancelled. I have updated the SDK also but nothing has changed. Any help is appreciated.