I’m using again the Facebook Marketing API. I successfully managed to create Facebook ads with my Node.js app, now I want to create ad for Instagram.
To create an AdCreative, my call is as follows:
fb.api('/act_' + rows[0].ad_act + '/adcreatives', 'post', {
"name": "Test Instagram",
"object_story_spec": {
"page_id": "XXXXX",
"instagram_actor_id": "YYYYY",
"link_data": {
"call_to_action": {
"type": "LEARN_MORE",
"value": {
"link": "http://example.com"
}
},
"image_hash": imgHash,
"link": "http://url.com",
"message": "Message test",
"caption": "caption text",
},
}
});
But the API always return the same message:
{ message: '(#100) Param must be a valid Instagram account id',
type: 'OAuthException',
code: 100,
fbtrace_id: 'Dr1XrUANRGr' }
rows[0].ad_act
is the right account ID.
XXXX
is a valid page id for that ad account.
YYYY
is a valid instagram ID that is set as the instagram ads account for the page (setting into FB).
I tried different Instagram accounts as well as pages.
2
Answers
This is the answer :
had to get the
instagram_actor_id
which is NOT theinstagram_account_id
.Graph API :
/someFbPageID/instagram_accounts
will return instagram account as agraphEdge
then get the id of that object, its theinstagram_actor_id
“YYYY is a valid instagram ID that is set as the instagram ads account for the page (setting into FB).”
There is not a concept of “Instagram ads account”. This YYYY needs to be a valid Instagram account (aka profile) ID. By “valid”, I mean:
As you mentioned that “I tried different Instagram accounts as well as pages.”, I felt that you are not using a pair of IG and FB accounts. Randomly coupling them won’t work.
BTW, the YYYY needs to be a number, which you can find on UI or by calling API in the doc I mentioned above. It cannot be an Instagram handle like “cooldude”.