0

I am having trouble getting ads information to return from the Facebook Ads API.

What I have done:

  • Created developer account and app
    • added Marketing API to the app
    • I have this in Live mode
    • All other settings are default as I cannot find information about which to change and why
  • Added App to Business account (can see it in Business Settings > Accounts > Apps)
    • Connected our ad accounts assets to this app
    • My "People" user has full control of the app, but I've touched no other settings with regards to our Ad accounts or the app

I am trying to use the Facebook Python Business SDK to get information about our campaign performance back from the API. When I go through the linked GitHub documentation, I hit a wall at the business side of things.

Authenticating - I can get my app id/secret and an access token. When I pass the following code in a python notebook:

from facebook_business.api import FacebookAdsApi
from facebook_business.adobjects.user import User

me = User(fbid='me')
list(me.get_ad_accounts())

I get an account_id/id pair that corresponds to the sandbox ad account created with the app.

If I try to look at the business via:

from facebook_business.api import FacebookAdsApi
from facebook_business.adobjects.business import Business

business = Business(<business_id>)
info_fields = ['name']
business.api_get(fields=info_fields)

This gives me he business name and id that I would expect.

If I go a step further and try to get an ad account ID via business.get_owned_ad_accounts() or even business.get_client_ad_accounts() I get an empty list as the return.

At this point I am stuck and not sure how to proceed. I am sure I have missing something in the settings that needs to be set up. Does anyone know the full set of steps to be able to use an App to look at Marketing API insights on a Business?

0