2

whenever creating or updating an Ad's creative, I'm getting this error:

{
    "error": {
        "message": "Invalid parameter",
        "type": "OAuthException",
        "code": 100,
        "error_subcode": 1772103,
        "is_transient": false,
        "error_user_title": "Instagram Account Is Missing",
        "error_user_msg": "You're using Instagram as a placement. Please select an Instagram account to represent your business in your Instagram ads, or select a Facebook Page to use instead.",
        "fbtrace_id": "..."
    }
}

However, what I simply try to do is to create an Ad for a specifc Page Post and add this to an existing AdSet. To create a new creative for a given Post, I use the /adcreatives endpoint and pass the following:

POST:  https://graph.facebook.com/v3.1/act_<ActId>/adcreatives 
{
    "name": "Test",
    "object_story_id":"<PostIdWithPage>",
}

This works fine so far. But the following update of the Ad results in the error above:

POST:  https://graph.facebook.com/v3.1/<AdId>
{
    "creative": {
        "creative_id": "<CreativeId>",
    } 
}

I guess, the above error happens when I try to add a creative to the Ad that can not be used on Instagram.

But why isn't it working like in the Business Manager? There, I can simply select a Post for a newly created Ad. If this Post is not valid for Instagram, it shows a warning but it still works.

So, when I want to create a tool that can create Ads based on given Posts, how can I achieve that? How can we come around the error above?

K. D.
  • 4,041
  • 9
  • 48
  • 72

3 Answers3

3

The important missing part here is, that we have to specify instagram_actor_id when creating the AdCreative. The ID can be retrieved by GETting <PageId>/page_backed_instagram_accounts.

K. D.
  • 4,041
  • 9
  • 48
  • 72
  • Hi can you please review this for instagram ads 1)grab id from pageid/page_backed_instagram_accounts 2)take data[0]['id'] from response 3)$params = array( 'instagram_actor_id'=> data[0]['id'] 'name' => 'Sample Creative', 'object_story_id'=>"178xxxxx"); echo json_encode((new AdAccount($id))->createAdCreative( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT) still gets Invalid parameter ,can you please tell what went wrong? –  Jun 25 '21 at 13:59
3

Further to the accepted answer, I needed a little bit more information to properly connect an instagram account to my page:

There are two ways to link in instagram account to your page:

1. Setup a 'Page Connected' instagram account

Log in as a page admin, go to page settings > instagram and link an existing instagram account to the page.

You can then get the linked instagram account id by doing a GET on:

<PageId>/instagram_accounts

2. Create a 'Page Backed' instagram account.

This is for when you don't have an existing instagram account you want to link to your page, and want to instead create a 'shadow' instagram account based off your page.

You can generate a paged backed instagram account by performing a POST on the following endpoint. And retrieve an existing one, by performing a GET.

<PageId>/page_backed_instagram_accounts

** Note that both these endpoints require you to have a 'page access token' rather than the normal 'account access token' you use to create your ads.

To get your page access token, you can do a GET request on:

/me/accounts

Then, as stated in the accepted answer - pass your new, linked instagram account id as the instagram_actor_id in your ad creative request.


Sources:

https://developers.facebook.com/docs/marketing-api/guides/instagramads/ https://developers.facebook.com/docs/facebook-login/access-tokens#pagetokens

Hannah
  • 76
  • 3
0

I know that this is an old thread but in case anyone comes here looking for a solution to a similar problem you might want to check which publisher_platforms are set in your Ad Set's targeting object.

If you did not specify publisher_platforms in your Ad Set creation then it may be including Instagram by default, thus requiring the Instagram ID. You can also adjust this in the UI by deselecting Instagram in your Ad Set settings, but if you are building a step by step workflow you need to make sure to include this in your Ad Set creation step.

Derrick
  • 21
  • 2