简体   繁体   中英

Facebook marketing API : Param must be a valid Instagram account id

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.

This is the answer :

had to get the instagram_actor_id which is NOT the instagram_account_id .

Graph API : /someFbPageID/instagram_accounts will return instagram account as a graphEdge then get the id of that object, its the instagram_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:

  1. It cannot be private. It has to be visible to the public. (default is not private.)
  2. It needs to be linked to a Facebook Page or business. https://developers.facebook.com/docs/marketing-api/guides/instagramads/v2.9
  3. If YYYY is linked to a Page, the Page needs to be XXXX.

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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM