Question

I am having an issue promoting an unpublished page post via the ads-api. This was previously working ok for me, but began causing problems yesterday.

I first create an ad_campaign, and then, using the returned campaign_id, I attempt to create an adgroup.

The response from the server is

array(1) {
  'error' =>
   array(3) {
     'message' =>
       string(53) "(#100) Invalid parameter: adgroup_spec["campaign_id"]"
     'type' =>
       string(14) "OAuthException" 
     'code' => int(100)
   }
}

I have verified that I am sending over the correct, newly created campaign_id.

Another point of interest; when I use the UI to delete the ad_campaign afterwards, I am told that I do not have permission to do so. User XXXX does not have permission to access campaign YYYY.

I'm thinking this must be an access_token/permission issue but I'm stumped. The ad objects are created using the user's token, and the unpublished page post is created using the page's access token.

NB: I can provide snippets if needs be, but I'm fairly sure this is a problem with the object creation flow as opposed to a code issue.

Has anyone seen anything similar?

Cheers, Gary

Update with POST data

array(7) {
  'campaign_id' =>
    int(6013621027457)
  'bid_type' =>
    int(6)
  'bid_info' =>
    string(37) "{"clicks":10,"reach":10,"actions":80}"
  'conversion_specs' =>
    string(66) "{"action.type":"offsite_conversion","offsite_pixel":6013619180457}"
  'creative' =>
    string(86) "{"type":27,"object_id":407012979370770,"auto_update":false,"story_id":565852233486843}"
  'name' =>
    string(23) "PropelAd (via PropelAd)"
  'targeting' =>
    string(95) "{"countries":["IE","AE","GB"],"friends_of_connections":[407012979370770],"page_types":["feed"]}"

}

Was it helpful?

Solution

Yes, it happens to me as well from time to time when uploading ads.

It's very statistical, and it seems to be an off-sync between Facebook servers (the campaign was already successfully uploaded, but the ad-request-handler does not recognize that id). Wait a few seconds, and try again - after a few shots, it will always work (usually there's no problem, it's pretty rare but happens - and never lasted more than a minute of not-recognizing).

Perhaps it happened more today, due to the general Facebook failures.

I can only assume/hope that Facebook keep track of these errors, and are working on minimizing them by syncing their servers better.

OTHER TIPS

Yep - we are currently putting a lot of time in checking why do ad group fail on unpublished posts - specifically on posts scheduled in the future.

The behavior is very inconsistent. The errors we get are slightly different: "Could not save ad", "Invalid ad creative". The errors are not reported on all ad groups but mostly on one of the ad groups of a whole batch.

We do make sure that the campaign start time is equal or AFTER the time the post is scheduled to.

When we publish the post now and test with the same campaign structure it succeeds (although this also succeeds sometimes on the second try - like it was mentioned here, that the campaign takes some time maybe to become fully valid)

A related bug I opened is here: https://developers.facebook.com/bugs/593878450648811?browse=external_tasks_search_results_52662e53c59bd2e63625449

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top