Instagram· 5 min read

Reply privately to Instagram comments through the API


Send a POST to the messages endpoint with recipient.comment_id set to the comment’s ID. Instagram delivers one message to the commenter, with a link to the post they commented on. You get one message per comment, within 7 days of the comment for posts, ads posts and reels, and only during the broadcast for live stories. The conversation continues only if the person answers, and then inside the 24-hour messaging window.

The rules Meta sets on a private reply

Meta’s Messenger Platform page describes the feature as a way “to send a single message to an Instagram user who commented” on a post, ads post, reel or live story (Private Replies, accessed 2026-11-02). The limits on that page are short.

Rule What Meta documents
Messages per comment “Only one message can be sent to the Instagram user who commented.”
Posts, ads posts, reels Send “within 7 days from when the comment was created”
Live stories Only during the live broadcast. Once it ends, private replies can no longer be sent.
Follow-up Only after the user responds, “within the 24-hour messaging window”
Standard Access Apps “can only access data for people who have a role on the app”

The reply lands in the user’s Inbox folder. If the user doesn’t follow your account, it goes to their Request folder instead. Either way, “the message will contain a link to the post that the Instagram user commented on.”

The private reply itself doesn’t open a conversation you can keep using. The 24-hour window starts when the commenter writes back. Until then, you have spent your one message on that comment. The Instagram Platform version of the page says the same: follow-up messages “can only be sent if the recipient responds, and must be sent within 24 hours of the response” (Send a Private Reply, accessed 2026-11-02). What you can send after that window closes is covered in the Instagram 24-hour window and the Human Agent tag.

Meta doesn’t document which error comes back on a second reply to the same comment, or on a reply after day 7. Record each comment you have answered on your side and check the comment’s age before you call the API.

Two endpoints, three login types

Meta documents the same feature on two platforms, and your login type decides which one you call.

The Messenger Platform path is POST /<PAGE_ID>/messages on graph.facebook.com with a Page access token. It needs the ID of the Page linked to your Instagram professional account and the instagram_manage_comments and pages_messaging permissions, obtained through Facebook Login. The token must come from an Instagram user who can perform the MESSAGING task. Meta also lists the Human Agent feature (see Messenger message tags) and Advanced Access as prerequisites.

The Instagram Platform path is POST /<APP_USERS_IG_ID>/messages, where the ID is your Instagram professional account. Permissions depend on how your users log in.

Login type Host Permissions Meta lists
Unified Login graph.facebook.com instagram_basic, instagram_manage_comments, plus instagram_manage_messages to send
Instagram Login graph.instagram.com instagram_business_basic, instagram_business_manage_comments
Facebook Login graph.facebook.com instagram_basic, instagram_manage_comments, pages_read_engagement; ads_management and ads_read if the app user has a role on the connected Page

The request

This is Meta’s Instagram Platform request, with line continuations added so it runs as pasted. Use the API version shown in your App Dashboard.

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>"
             }
         }'

<COMMENT_TEXT> is Meta’s placeholder name for the text of your reply. On the Messenger Platform path, send the same JSON body to https://graph.facebook.com/<API_VERSION>/<PAGE_ID>/messages with your Page access token. Meta’s own sample for that path puts the JSON inside the query string, which doesn’t run. Meta publishes no working body for this path, so test the one above before you rely on it.

A successful call returns the commenter’s Instagram-scoped ID and the ID of the message you sent.

{"recipient_id": "<INSTAGRAM_SCOPED_ID>", "message_id": "<MESSAGE_ID>"}

Getting the comment ID from webhooks

The comment ID comes from the comments webhook field for posts, ads posts and reels, and from live_comments for live stories. Meta recommends live_comments for live stories “to avoid rate limiting”, and asks you to size your server for the extra notifications a live session produces. It publishes no number for that rate limit.

The JSON below cleans up Meta’s Unified and Facebook Login example. As published, that example isn’t valid JSON: it has comments, a missing comma and a stray quote. It keeps Meta’s keys, with placeholder values (webhook examples, accessed 2026-11-02).

{
  "entry": [
    {
      "id": "<IG_PROFESSIONAL_ACCOUNT_ID>",
      "time": 1762041600,
      "changes": [
        {
          "field": "comments",
          "value": {
            "from": {
              "id": "<INSTAGRAM_SCOPED_ID>",
              "username": "<USERNAME>"
            },
            "comment_id": "<COMMENT_ID>",
            "parent_id": "<PARENT_COMMENT_ID>",
            "text": "<COMMENT_TEXT>",
            "media": {
              "id": "<MEDIA_ID>",
              "ad_id": "<AD_ID>",
              "ad_title": "<AD_TITLE>",
              "original_media_id": "<ORIGINAL_MEDIA_ID>",
              "media_product_type": "<MEDIA_PRODUCT_TYPE>"
            }
          }
        }
      ]
    }
  ]
}

parent_id appears when the comment answers another comment. ad_id and ad_title appear when someone comments on an ads post. A live_comments event has the same shape with field set to live_comments, so branch on field before you apply the 7-day rule. With Instagram Login, the comment ID arrives in value.id instead of value.comment_id.

The webhook field needs its own permissions. On Unified Login that’s instagram_manage_comments. Instagram Login needs instagram_business_basic and instagram_business_manage_comments. Facebook Login needs instagram_basic, instagram_manage_comments, pages_manage_metadata, pages_read_engagement and pages_show_list (webhook fields, accessed 2026-11-02). Meta’s advice on that page is to “subscribe only to the webhook fields required by your integration.”

Answer each comment once

Ads posts can trigger a reply twice. Meta warns that “commenting on a boosted or ads post may result in duplicate webhook notifications.” If your handler replies on every notification, the second call targets a comment you already answered. Use the comment ID as the idempotency key. Insert it into a table with a unique constraint, and send only when the insert succeeds. The idempotency pattern for duplicate webhooks shows the same approach in n8n.

A minimal guard in Node.js 18 or later, for comments on posts, ads posts and reels:

// reply.mjs. Run: IG_ID=... ACCESS_TOKEN=... HOST_URL=graph.instagram.com API_VERSION=v26.0 \
//   node reply.mjs COMMENT_ID ENTRY_TIME_SECONDS "Thanks, sending the details here"
const answered = new Set(); // replace with a table that has a unique key on comment_id
const MAX_AGE_MS = 6 * 24 * 60 * 60 * 1000; // one day of margin under Meta's 7 days
// entry.time is treated as Unix seconds below: confirm the unit in a real payload

export async function replyOnce(commentId, entryTimeMs, text) {
  if (answered.has(commentId)) return { skipped: 'already answered' };
  if (Date.now() - entryTimeMs > MAX_AGE_MS) return { skipped: 'too close to the 7-day limit' };
  answered.add(commentId);
  const res = await fetch(
    `https://${process.env.HOST_URL}/${process.env.API_VERSION}/${process.env.IG_ID}/messages`,
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${process.env.ACCESS_TOKEN}` },
      body: JSON.stringify({ recipient: { comment_id: commentId }, message: { text } }),
    },
  );
  return res.json();
}

if (process.argv[2]) {
  console.log(await replyOnce(process.argv[2], Number(process.argv[3]) * 1000, process.argv[4] ?? 'Thanks'));
}

The code marks the comment as answered before the call. A failed request then needs a manual decision instead of an automatic retry, which is safer when only one message is allowed. Meta’s comments example carries entry[].time and no separate creation field. Meta doesn’t say whether that time equals the moment of the comment, so the guard stops a day early.

Z-API Omni team