Post Moderation

Each ad creative with instagram_actor_id creates an Instagram Stream post for the Instagram account with that ID. You can use the API to access that post, add new comments, check the comments by viewers, and delete certain comments.

There are two ways to moderate your posts:

You cannot currently retrieve age-restricted media and comments via Marketing API. In this case, use the Instagram Graph API approach.

Learn more about restrictions for this feature.

Organic Vs. Non-Organic Comments

Part of moderating Instagram posts is handling comments left by users. We have two types of comments: organic and non-organic. Organic comments are those made on organic Instagram Media. Non-Organic comments are comments on ads media. Learn more about Instagram comments.

If you are using the Marketing API, you only get access to non-organic comments from your posts. To get the organic comments, you can use the Marketing API to get the IG Media's ID. Once you have the underlying ID, use the Graph API to get organic comments.

Use Marketing API

Ad creatives with instagram_actor_id have two fields called instagram_permalink_url and effective_instagram_story_id.

With instagram_permalink_url, you can get a URL for a corresponding Instagram post and can see user interactions with the ad post. Because you see this post on a website instead of the mobile Instagram app, it is not exactly what people viewing your ad see. It does not have "Sponsored" or Call To Action, nor it shows Carousel ads with multiple images.

To get an ad creative's instagram_permalink_url and effective_instagram_story_id:

curl -G \
-d "access_token=<ACCESS_TOKEN>"\
-d "fields=instagram_permalink_url,effective_instagram_story_id"\
"https://graph.facebook.com/<API_VERSION>/<AD_CREATIVE_ID>"

With effective_instagram_story_id, send a GET request to get all the comments for a post:

curl -G \
-d "access_token=<ACCESS_TOKEN>"\
-d "fields=id,message,instagram_user"\
"https://graph.facebook.com/<API_VERSION>/<EFFECTIVE_INSTAGRAM_STORY_ID>/comments"

The response includes only non-organic comments:

{
  "data": [
    {
      "id": "aWdfY29tbWVudDoxMTA1MjAx123wMTIxOTQxOTAxOjExMDUyMDEyMTQxNTYwODI4NTAZD",
      "message": "Where can I get it?"
      "instagram_user": {
        "id": "23333333333333"
      }
    }
    {
      "id": "aWdfY29tbWVudDoxMTA1MjAx123wMTIxOTQxOTAxOjExMjA1Mjc3ODM2MTEyNDAyNDQZD",
      "message": "This is nice.",
      "instagram_user": {
        "id": "33333333333333"
      }
    }
  ],
  "paging": {
    ...
  }
}

Get the user name of a commenter with the instagram_user/id returned. Available fields for instagram_user are at Instagram Ad Account Setup.

The id is a long hash string, not a numeric string. Get the comment message or the user name with the comment id with this GET request:

curl -G \
-d "access_token=<ACCESS_TOKEN>"\
-d "fields=message,instagram_user"\
"https://graph.facebook.com/<API_VERSION>/<ID_HASH_STRING>"

To create a new comment or to delete an unwanted comment, send a POST or DELETE request with the required parameters ad_id and message (message is only used if you are creating a new post). ad_id is the id of the ad which uses this ad creative. This means that these APIs cannot be used to moderate organic post comments on Instagram. See more under restrictions.

To create a new comment:

curl \
-F "access_token=<ACCESS_TOKEN>"\
-F "ad_id=<AD_ID>"\
-F "message=<COMMENT_MESSAGE>"\
"https://graph.facebook.com/<API_VERSION>/<EFFECTIVE_INSTAGRAM_STORY_ID>/comments"

To delete an unwanted comment:

curl -X DELETE -G \
-d "access_token=<ACCESS_TOKEN>"\
-d "ad_id=<AD_ID>"\
"https://graph.facebook.com/<API_VERSION>/<ID_HASH_STRING>"

The response is true if successful, or an error if otherwise. The first comment for each ad post cannot be deleted, since it is the ad caption you provided when you created the ad.

Send a GET request to the hashed comment id's replies edge to get a list of all the replies to a comment:

curl -G \
-d "access_token=<ACCESS_TOKEN>"\
-d "fields=message, instagram_user"\
"https://graph.facebook.com/<API_VERSION>/<ID_HASH_STRING>/replies"

You can create a reply to a comment by sending a POST request to this edge with the parameter ad_id and message, similar to creating a comment:

curl \
-F "access_token=<ACCESS_TOKEN>"\
-F "ad_id=<AD_ID>"\
-F "message=<REPLY_MESSAGE>"\
"https://graph.facebook.com/<API_VERSION>/<ID_HASH_STRING>/replies"

Use Instagram Graph API

Additional permissions are needed to utilize the Instagram Graph API to manage comments on Instagram ads. For more details, see the permissions sections here.

If you are familiar with the Instagram Graph API, you may find it easier to use Instagram Graph API endpoints to manage comments on Instagram posts. To fetch the Instagram media ID from an ad creative:

curl -G \
-d "access_token=<ACCESS_TOKEN>"\
-d "fields=instagram_permalink_url,effective_instagram_media_id"\
"https://graph.facebook.com/<API_VERSION>/<AD_CREATIVE_ID>"

With instagram_permalink_url, you can get a URL for an Instagram post and see that post's user interactions. Once you open the URL, you do not see exactly what people viewing your ad see. Your URL preview will not display "Sponsored" or your call to action, nor will it show Carousel ads with multiple images. This happens because you are using an internet browser, not the Instagram app.

With effective_instagram_media_id, send a GET request to get all the comments for a post:

curl -G \
-d "access_token=<ACCESS_TOKEN>"\
-d "fields=id,text,user"\
"https://graph.facebook.com/<API_VERSION>/<EFFECTIVE_INSTAGRAM_MEDIA_ID>/comments"

Check the following pages for instructions on how to:

Limitations

  • Post-moderation are not available for Instagram stories. Stories are not posts open to comment.
  • Comment moderation features do not work with Advantage+ catalog ads. effective_instagram_story_id and effective_instagram_media_id in ad creative do not work with template creative for Advantage+ catalog ads.