FaceBook Marketing API是否公开了自定义受众群体创建?

时间:2016-03-17 13:50:13

标签: python facebook facebook-marketing-api

我无法从API(特别是Python API)中找到任何文档或其他如何执行此操作的示例。所有文档都是指通过Power Editor或广告管理系统上传自定义受众.csv。还有其他人遇到过这个吗?

1 个答案:

答案 0 :(得分:1)

https://developers.facebook.com/docs/marketing-api/reference/custom-audience https://developers.facebook.com/docs/marketing-api/reference/custom-audience/users/

from facebookads.objects import CustomAudience

audience = CustomAudience(parent_id='act_<AD_ACCOUNT_ID>')
audience[CustomAudience.Field.subtype] = CustomAudience.Subtype.custom
audience[CustomAudience.Field.name] = 'My new CA'
audience[CustomAudience.Field.description] = 'People who bought on my website'

audience.remote_create()

然后:

from facebookads.objects import CustomAudience

audience = CustomAudience('<CUSTOM_AUDIENCE_ID>')
users = ['test1@example.com', 'test2@example.com', 'test3@example.com']

audience.add_users(CustomAudience.Schema.email_hash, users)