Posts tagged with facebook-graph-api

I'm encountering an issue with retrieving Instagram posts using the Facebook Graph API. When I use recent timestamps within a month, the following code works fine:

graph.facebook.com/v19.0/{instagram_business_account}?fields=business_discovery.username({ig_user_id}){media.since(1704477217).until(1714477219){timestamp,caption}}&access_token={access_token}

However, when I attempt to use older timestamps, even though the time interval (difference between since and until) remains the same, the request doesn't return the expected results.

For instance:

graph.facebook.com/v19.0/{instagram_business_account}?fields=business_discovery.username({ig_user_id}){media.since(1672834201).until(1672835201){timestamp,caption}}&access_token={access_token}

Despite being certain that there's a specific post at that interval of time, the API doesn't seem to return it.

Response example not showing conversions:

I'm trying to retrieve some ads insights so I can use them in my custom dashboard, everything is good but anything is related to conversions(results) is not returning in response. I gave all permissions to the access token and still no results.

What's the problem and how can I get this conversions/leads/results?

this is the required permissions for reading ads: read_insights, ads_management, ads_read, business_management, leads_retrieval. all of them included in the access token.

I'm encountering an issue while implementing login with Facebook APIs in my Laravel(v5.7) application. When attempting to connect to the Facebook Graph API endpoint (graph.facebook.com:443), I'm receiving the following error:
OpenSSL SSL_connect: Connection was reset in connection to graph.facebook.com:443

This error occurs during the authentication process, and it's preventing users from logging in using their Facebook accounts

code snippet:

public function addFacebookAccount($adsAccount = false)     {         $message = "Your account is connected. Check back later as data is populated.";         $helper = $this->connection()->getRedirectLoginHelper();         if ($state = \Request::get('state', null)) {             $helper->getPersistentDataHandler()->set('state', $state);         }         try {             $token = (string) $helper->getAccessToken();             if ($adsAccount) {                 $fb_user = (new Support\Endpoints\FacebookUser($token))->me();                 $account = FacebookApi::firstOrCreate([                     'company_id'        => \App\Models\Client::current(),                     'social_account_id' => $fb_user['id']                 ], ['social_account_name' => $fb_user['name']]);                                  $account->access_token = $token;                 $account->save();                 $this->initializeAdAccountTokens($account->social_account_id, $account->access_token, $account->company_id);             } else {                 $fb_user = (new Support\Endpoints\FacebookUser($token))->me();                 $account = FacebookApi::firstOrCreate([                     'company_id'        => \App\Models\Client::current(),                     'social_account_id' => $fb_user['id']                 ], ['social_account_name' => $fb_user['name'], 'is_disabled' => 0]);                                  $account->access_token = $token;                 $account->save();                 $this->insertUserPageTokens($account);             }         } catch (FacebookResponseException $e) {             // When Graph returns an error             \Log::info('Graph returned an error: ' . $e->getMessage());             $message = 'We could not log you in at this time';         } catch (FacebookSDKException $e) {             // When validation fails or other local issues             \Log::info('Facebook SDK returned an error: ' . $e->getMessage());             $message = 'We could not log you in at this time';         } return isset($fb_user) ? ['info' => $message, 'name' => $fb_user['name']]:          ['info' => $message];     } 

my logs file :

Facebook SDK returned an error: OpenSSL SSL_connect: Connection was reset in connection to graph.facebook.com:443enter image description here 

How can I troubleshoot and resolve this issue?

I am using Meta graph api https://developers.facebook.com/docs/instagram-api/guides/content-publishing/#reels-posts

and it is working fine for publishing reels immediately.

I don't see in the documentation of any mention of how to schedule the reel at a particular time. (In contrast, you can do this for facebook reels by using scheduled_publish_time

I read online that this should be possible for Instagram as well https://business.instagram.com/blog/instagram-api-features-updates

Question Can you guide me with one example of how to schedule Instagram reel via API ?

Two more optional ones

  1. (Optional) Can I upload video from my local to instagram ? In the docs they require video_url, but for facebook api I can also upload data from local file
  2. (Optional) Is it possible to cross-post in instagram-facebook, same way we can do via Meta Business Suite

Thanks in advance