skip to Main Content

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


  1. Chosen as BEST ANSWER

    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


  2. “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”.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search