facebook / facebook-python-business-sdk

Python SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
1.32k stars 645 forks source link

Permission Error with creative_sourcing_spec #678

Open Douglas42digital opened 4 months ago

Douglas42digital commented 4 months ago

`sitelinks = [ { 'site_link_title': 'Link 1 Title', 'site_link_url': 'https://example.com/link1' }, { 'site_link_title': 'Link 2 Title', 'site_link_url': 'https://example.com/link2' }, ]

promotion_metadata = [ { 'end_date': 1627776000, 'promotion_source': 'ADVERTISER_INPUT', 'promotion_type': 'PERCENTAGE_OFF', 'promotion_value': 10.0, 'required_code': 'SUMMER10', 'start_date': 1625097600, } ] creative_sourcing_spec = { "site_links_spec": sitelinks,

"promotion_metadata_spec": promotion_metadata,

"source_url": 'https://www.digital.de/'

}

creative_params = { 'name': 'Your Ad Creative Name', 'object_story_spec': { 'page_id': page_id, 'instagram_actor_id': instagram_page_id, 'link_data': { 'link': 'https://www.digital.de/', 'message': 'Testing Your ad message', 'name': 'Testing Your headline', 'description': 'Testing Your ad description', } }, 'contextual_multi_ads': { "enroll_status": "OPT_IN" }, 'degrees_of_freedom_spec': { 'creative_features_spec': { 'standard_enhancements': { 'enroll_status': 'OPT_IN' } } }, 'creative_sourcing_spec': creative_sourcing_spec }

ad_creative = AdAccount(ad_account_id).create_ad_creative(fields=[], params=creative_params) print(ad_creative)

ad_params = { 'name': 'Testing Site Links and Offers Ad Name', 'adset_id': 209987......, 'creative': {'creative_id': ad_creative['id']}, 'status': 'PAUSED', }

AdAccount(ad_account_id).create_ad(fields=[], params=ad_params) `

What permissions are required to use creative_sourcing_spec? Is the above implementation correct for using sitelinks and promotion metadata in an ad?