Private Replies

This documents shows you how to programmatically send a private reply to a person who commented on your Instagram professional post, reel, story, Live, or ad post.

How It Works

  1. An Instagram user comments on your app user's Instagram professional post, reel, story, Live, or ad post.
  2. A webhook event is triggered and Meta sends your server a notification with information about the comment including:
    • Your app user's Instagram professional account ID, (<IG_PRO_USER_ID>)
    • The commentor's Instagram-scoped ID and username, (<IG_SCOPED_ID>) and (<USERNAME>), respectively
    • The comment's ID, (<COMMENT_ID>)
    • The media's ID, if the commentor included media in their comment, (<MEDIA_ID>)
    • The text of the comment, if applicable, (<COMMENT_TEXT>)
  3. Your app can then use the comment's ID to send a private response directly to the Instagram user. This reply will be delivered in the person's Inbox folder, if the person follows the Instagram professional account, or to the person's Request folder, if the person does not follow the account.
  4. You can send this private reply within 7 days of the creation time of the comment, excepting Instagram Live for which you can only send a private reply during the live broadcast. The private reply message will contain a link to the post that the person commented on.

Before You Start

This guide assumes you have set up your webhooks server to receive notifications and subscribed your app to Instagram comments and live_comments events.

Note: When hosting an Instagram Live story, make sure your server can handle the increased load of notifications triggered by live_comments webhooks events and that your system can differentiate between live_comments and comments notifications.

You will need:

  • An Instagram User access token requested from a person who can send a message from the Instagram professional account
  • The instagram_business_basic and instagram_business_manage_messages permissions

From the comments or live_comments webhook notification (recommended) or Instagram Comment Moderation API:

  • Your app user's Instagram professional account ID, <IG_PRO_USER_ID>
  • The comment's ID for which you want to send a private reply, <COMMENT_ID>

Host URL

https://graph.instagram.com

Limitations

  • Only one message can be sent to the person who commented
  • The message must be sent within 7 days from when the comment was created for comments on a post or reel
  • Due to the transient nature of Instagram Live, private replies on Instagram Live comments can only be sent during the live broadcast. As soon as the live broadcast has ended, private replies can no longer be sent.
  • Your app users can only send follow-up messages if the recipient of their private reply responds, and any follow-up messages must be sent within 24 hours of this response.

Send a Private Reply

To send a private reply to a person who commented on your app user's Instagram professional post, reel, or story, send a POST request to the <IG_PRO_USER_ID>/messages endpoint where the recipient parameter contains the comment's ID and the message parameter contains the text you wish to send.

Sample request

Formatted for readability.
curl -i -X POST "https://graph.instagram.com/<IG_PRO_USER_ID>/messages"
     -H "Content-Type: application/json" 
     -H "Authorization: Bearer <INSTAGRAM_USER_ACCESS_TOKEN>" 
     -d '{
             "recipient":{ 
                 "comment_id": "<COMMENT_ID>" 
             },
             "message": { 
                 "text": "<COMMENT_TEXT>" 
             }
         }'

On success, your app will receive a JSON response with the recipient's Instagram-scoped ID and the ID for the message.

{
  "recipient_id": "526...",   // The Instagram-scoped ID 
  "message_id": "aWdfZ..."    // The ID for your private reply message
}