The Comment Moderation API is a subset of Instagram Graph API endpoints that allow you to reply to comments, delete comments, hide/unhide comments, and disable/enable comments on your Business Account's media object.
The API consists of the following endpoints:
Refer to each endpoint's reference documentation for parameter and permission requirements.
You can get all of the comments on one of your media objects, analyze and filter the returned data set against specific criteria, then reply to any comments that match your criteria.
First, use the /media/comments
edge to get all of the comments and their IDs on your media object:
GET graph.facebook.com /17895695668004550/comments
{ "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 Users who made the comments:
POST graph.facebook.com /17870913679156914/replies?message=Thanks%20for%20sharing!
{ "id": "17873440459141029" }
If you have a lot of comments that you want to reply to, you could batch the replies into a single request.