Posts tagged with facebook-php-sdk

I am currently working with the Meta Business Manager and the Facebook Graph API. In the Meta Business Manager UI, under Business Info, I can see a field labeled Ad account creation limit, which shows the maximum number of ad accounts that can be created for a particular business.

However, I am unable to find any relevant endpoint or field in the Facebook Graph API documentation that would allow me to fetch this information programmatically. I have searched through the available endpoints for businesses and ad accounts but haven’t found anything that matches.

Does anyone know if it's possible to retrieve the Ad account creation limit via the Facebook Graph API? If so, could you point me to the correct endpoint or provide an example of how to fetch this data?

From Facebook document: https://www.facebook.com/business/help/652738434773716 "You can have up to 5,000 ads. Only 1,000 of these 5,000 ads can use dynamic creative."

Some my adaccounts have an issue "Your account xxxx has reached the maximum number of dynamic creative ads allowed (1,000). Please delete some of your older ads."

How can I count ads that are using "dynamic creative"? Note: I can count ads by

        $adAccount = new AdAccount($adAccountId);         $cursor = $adAccount->getAds(             params: [                 'date_preset' => 'today',                 'summary' => 'total_count',                 'limit' => 1,             ]         ); 

It is great if I can find an API to get numbers ads use dynamic creative belong to each adaccount

  • I'm using Laravel Socialite to handle Facebook authentication in my Laravel application, and I’m working in a test environment only. I have successfully integrated Socialite to allow users to log in with their Facebook accounts. Now, I need to fetch a list of the user's Facebook friends after they authenticate.

  • I've reviewed the Laravel Socialite documentation and the Facebook Graph API documentation, but I’m unsure how to proceed with obtaining the list of friends.

  • Facebook Permissions: I’ve made sure to request the user_friends permission during the login process.

  • API Calls: I’ve attempted to use the Graph API directly to fetch friends but haven't been able to integrate it smoothly with Socialite.

Here’s a snippet of the code I’m using to authenticate users:

public function redirectToProviderFacebook(){        return Socialite::driver('facebook')->scopes(['user_friends'])->redirect();     } public function handleProviderCallbackFacebook(Request $request){         try {             $user = Socialite::driver('facebook')->stateless()->user();             $accessToken = $user->token;             // Get friends             $response = Http::withToken($accessToken)                 ->get('https://graph.facebook.com/me/friends');             $friends = $response->json();             dd($friends);             $data = User::where`your text`('email', $user->email)->first();             if (is_null($data)) {                 $users['name'] = $user->name;                 $users['email'] = $user->email;                 $users['password'] = Hash::make('password');                 $data = User::create($users);             }             Auth::login($data);             return redirect('dashboard');         } catch (\Exception $e) {             // Log the error or return a meaningful message             Log::error('Facebook OAuth error: ' . $e->getMessage());             return redirect()->route('login')->with('error', 'Authentication failed.');         }     } 
  • How do I use Laravel Socialite to fetch a user’s list of friends from Facebook in a test environment?

  • Are there any specific settings or configurations needed in the Facebook Developer Console for accessing friends data in a test environment?

  • Can you provide an example of how to make a request to the Facebook Graph API to get friends data after authentication?

Any guidance or examples would be greatly appreciated!

I am trying to create an APP ENGAGEMENT campaign using Facebook ads API. I want to optimize (performance goal) the adset based on custom/standard events associated with the app; not based on clicks or app installs.

I am setting optimization_goal as OFFSITE_CONVERSIONS. Inorder to pass promoted_object, the event name is required. Promoted object will be passed as

{    "application_id" : <APP_ID>,    "object_store_url" : <APP_URL>,    "custom_event_type" : <EVENT_TYPE> } 

In Ads manager UI; when I select the app all the events associated with app are displayed. If no events are associated with the app, it's asking to create an event. How to get all these events via Ads API?