Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application Permission error when using creative_sourcing_spec #97

Open
5 tasks done
Douglas42digital opened this issue Jul 31, 2024 · 0 comments
Open
5 tasks done
Labels
bug Something isn't working

Comments

@Douglas42digital
Copy link

Douglas42digital commented Jul 31, 2024

Checklist

Environment

python environment

Goals

I want to create ads with site links using the 'creative_sourcing_spec' key in Adcreative

Expected Results

Ads created with sitelinks

Actual Results

Status: 400
Response:
{
"error": {
"message": "(#10) Application does not have permission for this action",
"type": "OAuthException",
"code": 10,
"fbtrace_id": "A4tpKntRJhpF3ww0FQjvqyH"
}
}

Steps to Reproduce

Try creating an ad using creative_sourcing_spec

Code Samples & Details

ad_account_id = 'act_70xxxxx'

FacebookAdsApi.init(access_token=fb_access_token,api_version='v20.0')

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'
   },
     {
       'site_link_title':'Link 3 Title',
       'site_link_url':'https://example.com/link3'
   }
]

promotion_metadata = [
    {
        'end_date': 1627776000,
        #'id': 'id_string',# valid offer_id
        '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'
}

# Create the ad creative
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)
ad_params = {
        'name': 'Testing Site Links and Offers Ad Name',
        'adset_id': 238xxxxxxxx,
        'creative': {'creative_id': ad_creative['id']},
        'status': 'PAUSED',
    }
AdAccount(ad_account_id).create_ad(fields=[], params=ad_params)
@Douglas42digital Douglas42digital added the bug Something isn't working label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant