Getting empty object when sharing lookalike audience with adaccount - Facebook API

48 Views Asked by At

Making a POST request to share Custom Facebook Audience POST {custom_audience_id}/adaccounts?adaccounts=[<ad_account_id>]&relationship_type=[<relationship_type>] returns the object as per the official documentation here

{  
    success: bool,
    sharing_data : [
     {         
       "ad_acct_id": id
       "business_id": id
       "audience_share_status" : string
       "errors" : list<string>
     },
     ...
    ]
}

When trying to share the created lookalike audience the sharing is successful but the sharing_data object comes as an empty list [] This means that I need to check the sharing status for this particular audience with a separate GET call to {audience_id}/shared_account_info. Which seems to have different responses for custom audiences and for lookalike audiences.

  • I tried to find any documentation explaining this logic to no success. I am using https://graph.facebook.com/v8.0/ version of graph api
  • I tried to send fields with POST requests but still get the empty list

Is there any workaround or this is the only way to do it?

The code I am using:

from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.api import FacebookAdsApi
FacebookAdsApi.init(access_token=access_token)
method = 'POST'
endpoint = f'https://graph.facebook.com/v8.0/{audience_id}/adaccounts'
params = {'adaccounts': str(partner_ad_account_id),
          'relationship_type': ['Audience Info Provider', 'Information Manager']}
response = AdAccount(adaccount_id).get_api_assured().call(
                method,
                endpoint,
                params=params
            )
0

There are 0 best solutions below