[go: up one dir, main page]

Comment Moderation

You can use the Instagram Graph API to get comments, reply to comments, delete comments, hide/unhide comments, and disable/enable comments on IG Media owned by your app users.

Starting August 27, 2024, the instagram_manage_comments will be required to access the username field of an Instagram user who commented on media of an app user's Instagram professional account.

You can use the Instagram Messaging API to send private replies (direct messages) to users who have commented on your app users' live video IG Media. Refer to the Instagram Messaging's private replies documentation to learn how.

Endpoints

The API consists of the following endpoints. Refer to each endpoint's reference documentation for parameter and permission requirements.

Examples

Getting & Replying to Comments

You can get all of the comments on a media object, analyze and filter the returned data set against specific criteria, then reply to any comments that match your criteria.

First, query the GET /{ig-media-id}/comments endpoint to get all of the comments and their IDs on the media object:

Sample Request

GET graph.facebook.com
  /17895695668004550/comments

Sample Response

{
  "data": [
    {
      "timestamp": "2017-08-31T18:10:30+0000",
      "text": "I love this!",
      "id": "17873440459141021"
    },
    {
      "timestamp": "2017-08-31T19:16:02+0000",
      "text": "This is awesome!",
      "id": "17870913679156914"
    },
    ... // results truncated for brevity
  ]
}

Next, parse the returned results for comments that match whatever criteria you are using and use the matching comments to reply in the comment thread to the Instagram users who made the comments:

Sample Request

POST graph.facebook.com
  /17870913679156914/replies?message=Thanks%20for%20sharing!

Sample Response

{
  "id": "17873440459141029"
}

If you have a lot of comments that you want to reply to, you could batch the replies into a single request.