Private Replies

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

How It Works

Step 1. An Instagram user comments on your app user's Instagram professional post, reel, story, Live, or ad post.

Step 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
  • The commentor's Instagram-scoped ID and username
  • The comment's ID
  • The media's ID, if the commentor included media in their comment
  • The text of the comment, if applicable

Step 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.

Step 4. Your app can send this private reply within 7 days of the creation time of the comment, excepting Instagram Live for which your app 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.

Requirements

This guide assumes you have read the Instagram Platform Overview and implemented the needed components for using this API, such as a Meta login flow and a webhooks server to receive notifications.

You will need the following:

Instagram API with Instagram LoginInstagram API with Facebook Login

Access Tokens

  • Instagram User access token

Host URL

graph.instagram.com

graph.facebook.com

Login Type

Business Login for Instagram

Facebook Login for Business

Permissions
  • instagram_business_basic
  • instagram_business_manage_comments
  • instagram_basic
  • instagram_manage_comments
  • pages_read_engagement

If the app user was granted a role on the Page connected to your app user's Instagram professional account via the Business Manager, your app will also need:

  • ads_management
  • ads_read

Webhooks

  • comments
  • live_comments
  • comments
  • live_comments

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 <APP_USERS_IG_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://<HOST_URL>/<API_VERSION>/<APP_USERS_IG_ID>/messages"
     -H "Content-Type: application/json" 
     -H "Authorization: Bearer <ACCESS_TOKEN>" 
     -d '{
             "recipient":{ 
                 "comment_id": "<COMMENT_ID>" 
             },
             "message": { 
                 "text": "<COMMENT_TEXT>" 
             }
         }'

On success, your app receives 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 the private reply message
}