Posts tagged with facebook-graph-api

I have checked this condition.

  • I checked and verified the privacy policy URL, terms and conditions URL and account delete step URL.
  • Deleted and recreated the app configuration, then checked again.

Issue message -

Platform Term 7.d Platform Term 7.d - App Settings Platform URLs are broken During regular review of apps on the Meta for Developers platform, we found that one or more of the Platform URLs listed in App Settings returns an error. This violates Platform Term 7.d. To resolve this violation, and app admin must complete these steps: Check that the URLs and App Store IDs listed for the Platforms selected in App Settings are up to date and functional. For an overview of these platforms, visit Platform Settings. Test your URLs for errors using Meta’s Sharing Debugger. Look for valid codes 200–299 in the “Response Code'' field. Violating codes are 100–199, 300–299, 400–499, 500–599. Allowlist the IP addresses (most secure) or the user agent strings used by Meta’s URL crawler. If you don't take action to resolve this issue before the due date, your app will be deactivated. Your app will not be reinstated until we confirm that the violation is resolved.

public static void uploadVideo(String token, String urlVideo) {     FacebookClient fbClient = new DefaultFacebookClient(token, Version.LATEST);     long scheduledTime = System.currentTimeMillis() / 1000 + 30 * 60;     FacebookType scheduledPostResponse = fbClient.publish("me/videos", FacebookType.class,             Parameter.with("file_url", urlVideo),             Parameter.with("published", false),             Parameter.with("scheduled_publish_time", scheduledTime)); 

I want to post on the site with the condition that I schedule a posting appointment. I used restFB to successfully send the request and receive the ID back, but until now the post does not appear on the page

I have set up application development mode

We want to use the Instagram Graph API to get a list of public accounts that have used a specific tag recently (or a @). I already set the app up but before I am going to dive more deeply, I want to ask whether this is possible. Because the last post I read about it (in 2020) it wasn't possible due to privacy, but the lines that were quoted, aren't in the recent manual so I am not sure whether it is still applicable. I can't find another recent answer about it.

Does someone knows this? Thank you so much!

Post I mentioned Facebook Instagram Graph Api Get Tags with username The recent manual: https://developers.facebook.com/docs/instagram-api/guides/hashtag-search

I already googled it to try to find the answer

I have been trying to fetch posts from instagram user profiles that are not professional/business profiles.

I am using below url: https://graph.instagram.com/USER_ID/media?fields=id,caption,media_type,media_url,thumbnail_url,permalink,timestamp&access_token=ACCESS_TOKEN Instead of giving me posts it gives me this error: Sorry, this content isn't available right now

Question: How can I use Instagram Basic Display API to fetch page or user posts without having the user to login through instagram or facebook?

I'm trying to get all ads from a Facebook ad account that have metrics with 'spend' set to 0 and 'reach' set to 1 using GRAPH API SDK v.19. However, if 'reach' does not exist, this filter skips ads that have 'spend' at 0. On the other hand, if in my filter I put 'reach' at 0 and 'spend' at 0, this brings me all the ads of the ad account (+5000) even if they do not have metrics on the specified date. How can I fix this problem and get only the ads that have metrics with 'spend' greater than or equal to 0 excluding those without.

I tried using Facebook's Graph Explorer to get all the ads in an ad account that have metrics. I used the 'filtering' field in my query to filter the results based on these criteria of spend greater than or equal to 0 and reach greater than or equal to 1. However, if 'reach' does not exist, this filter ignores ads that have 'spend' at 0. On the other hand, if in my filter I put 'reach' at 0 and 'spend' at 0, this brings me all the ads in the ad account even if they do not have metrics on the specified date. I was hoping to get only the ads that have metrics.

I share graph explorer URL: act_384943998894065/ads?fields=id,name, effective_status,created_time,insights.time_range({'since':'2024-06-19','until':'2024-06-19'}){ad_id,reach,spend,objective,actions,cost_per_action_type}&filtering=[{"field":"spend","operator":"GREATER_THAN_OR_EQUAL","value":0},{"field":"reach","operator":"GREATER_THAN_OR_EQUAL","value":0}]&time_range={'since':'2024-06-19','until':'2024-06-19'}

attached image of graph explorer results:

{       "id": "120208793679360133",       "name": "CE1705202404",       "effective_status": "ACTIVE",       "created_time": "2024-05-17T14:59:20-0500"     },     {       "id": "120208458805660133",       "name": "CE202404301910",       "effective_status": "ACTIVE",       "created_time": "2024-05-09T12:23:30-0500",       "insights": {         "data": [           {             "ad_id": "120208458805660133",             "spend": "0",             "objective": "OUTCOME_ENGAGEMENT",             "actions": [               {                 "action_type": "onsite_conversion.messaging_welcome_message_view",                 "value": "1"               }             ],             "cost_per_action_type": [               {                 "action_type": "onsite_conversion.messaging_welcome_message_view",                 "value": "0"               }             ],             "date_start": "2024-06-19",             "date_stop": "2024-06-19"           }         ],         "paging": {           "cursors": {             "before": "MAZDZD",             "after": "MAZDZD"           }         }       }     }, 

I attach my PHP code:

public function getAdsByAccountId($date){         try {             $date_range = "{'since':'$date','until':'$date'}";             $time_range = "&time_range=$date_range";             $fields = [                 "id", "campaign_id", "adset_id", "adset{promoted_object}", "creative{id,image_url,video_id,object_story_spec}", "name", "created_time", "status", "effective_status", "configured_status",                 "campaign{id,account_id, name, objective, effective_status, status, configured_status, created_time}",                 "insights.time_range($date_range){ad_id,reach,spend,objective,actions,cost_per_action_type}",             ];             $string_fields = $this->buildFields($fields);             $filtering = "&filtering=[{'field':'spend','operator':'GREATER_THAN_OR_EQUAL','value':0},{'field':'reach','operator':'GREATER_THAN_OR_EQUAL','value':1}]";             $limit = "&limit=200";             $url = "/" . $this->BUSINESS_ACCOUNT_ID . "/ads" . $string_fields . $filtering . $time_range . $limit;             $response = $this->FB_SDK->get($url, $this->ACCESS_TOKEN);             $response = json_decode($response->getBody());             $ads = $response->data;             $data = $this->getAdsFromNextPages($response, $ads);             $ads = $data->ads;             $response = $data->response;             return (object) [                 "ads" => $ads,                 "response" => $response,             ];         } catch (\Facebook\Exceptions\FacebookResponseException $e) {             Log::error('FacebookAdsService::getAdsByAccountId Graph returned an error: ' . $e->getMessage());             throw $e;         } catch (\Facebook\Exceptions\FacebookSDKException $e) {             Log::error('FacebookAdsService::getAdsByAccountId Facebook SDK returned an error: ' . $e->getMessage());             throw $e;         }     }