使用图形API创建Facebook Audience

时间:2018-04-09 13:00:03

标签: python facebook facebook-graph-api

我正在关注此文档https://developers.facebook.com/docs/marketing-api/audiences-api 并尝试创建一个空白的观众。

我正在使用我的帐户ID和访问令牌,但我收到此错误 “不支持的帖子请求。ID为'692xxxxxxxx1141'的对象不存在,由于缺少权限而无法加载”

from facebookads.adobjects.customaudience import CustomAudience
from facebookads.adobjects.adaccount import AdAccount

FacebookAdsApi.init(access_token='EAAGbDDbxxxxxx')

ad_account = AdAccount(fbid='692xxxxxxxx1141')

params = {
    CustomAudience.Field.subtype: CustomAudience.Subtype.custom,
    CustomAudience.Field.name: 'My new CA',
    CustomAudience.Field.description: 'People who bought on my website',
}
audience = ad_account.create_custom_audience(params=params)

1 个答案:

答案 0 :(得分:-1)

帐户ID以前缀开头:

ad_account = AdAccount(fbid='692xxxxxxxx1141')