I have an access token for Facebook Audiences but I am not able to get create a custom audience using Python-SDK
First I get information about USER id using the following link:
https://developers.facebook.com/tools/debug/accesstoken
Than I use the following URL to list Ad ID's from my account:
https://graph.facebook.com/v3.2/MY_USER_ID/adaccounts
It returns a json with a list of act's like this:
{ "data": [ { "account_id": "xxxx", "id": "act_xxxx" } ] }
With this ID I try to create a new audience:
from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.adobjects.customaudience import CustomAudience
from facebook_business.api import FacebookAdsApi
id = 'act_xxxx'
FacebookAdsApi.init(access_token='MY TOKEN')
fields = [
]
params = {
'name': 'My new Custom Audience',
'subtype': 'CUSTOM',
'description': 'People who purchased on my website',
'customer_file_source': 'USER_PROVIDED_ONLY',
}
print(AdAccount(id).create_custom_audience(
fields=fields,
params=params,
))
Then the code produces the following error:
Unsupported post request. Object with ID 'act_xxxx' does not exist, cannot be loaded due to missing permissions, or does not support this operation.
I know that this ID exists because it was returned by the previous call. Debugging the access token I can see it has the following access:
read_insights, read_audience_network_insights, publish_video, manage_pages, pages_manage_cta, pages_manage_instant_articles, pages_show_list, publish_pages, read_page_mailboxes, ads_management, ads_read, business_management, pages_messaging, pages_messaging_phone_number, pages_messaging_subscriptions, instagram_basic, instagram_manage_comments, instagram_manage_insights, leads_retrieval
Can anyone help me to discover the reason of this error?
Thanks!