Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Marketing API ad creatives

I have the facebook application with approved ads_read, manage_pages ads_management, business_management and Ads Management Standard Access permissions.
I can create Ad campaign, ad set and can upload asset to Facebook via Facebook Marketing API.

But when I try to create ad creative, with /adcreatives request, I get Error with message:

(#3) Application does not have the capability to make this API call.

The example of curl request:

curl -X POST \
  'https://graph.facebook.com/v3.3/act_<account_id>/adcreatives?access_token=<access_token_here>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Host: graph.facebook.com' \
  -d 'call_to_action_type=USE_APP&actor_id=<page_id>&object_type=APPLICATION&status=active&name=hello&title=foo&page_id=<page_id>&id=act_<account id>&image_hash=fb1a69e0965076e791183ac82c9f7417'

I've tried making requests with app token, with page token and with user token (which was allowed in FB Business manager).
I've also tried with sandbox account and it's token
Every service (app, facebook page and user) connected with business account in business manager and have admin (max) permissions.

I've tried to send data in body with JSON request, I've tried to send data as x-www-form-urlencoded.
I've tried using plain http requests and tried with facebook-nodejs-business-sdk
But still no success.

So, the question is, what is the correct AD Creative create request and what permissions does my app need to perform such task?

P.S. I've also asked a few questions on Facebook Developers forum and got no solution. q1, q2, q3

like image 777
Grynets Avatar asked May 28 '19 09:05

Grynets


1 Answers

I believe your input is malformed (although the returned errors from FB usually never indicate as much).

The main issue that I see is that the creative information is not being passed through the object_story_spec parameter. The type of creative you are making is passed in through this object along with the necessary parameters, which would be photo_data in your case.

curl -X POST \
  'https://graph.facebook.com/v3.3/act_<ACT_ID>/adcreatives?access_token=<TOKEN>' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Host: graph.facebook.com' \
  -d 'link_url=<URL>&name=<CREATIVE_NAME>&object_type=PAGE&object_story_spec={page_id:<PAGE_ID>,photo_data:{image_hash:<HASH>,caption:<CAPTION>}}'

You will probably need to add or remove parameters as needed, but the above request worked for me.

In terms of permissions, here is what I had:

enter image description here

Some additional references:
Ad Creative
Object Story Spec
Photo Data

like image 130
Abundance Avatar answered Nov 17 '22 10:11

Abundance