---
title: "How to auto-reply to Instagram comments with a DM"
description: "DM everyone who comments a keyword on Instagram: Meta's private replies API, its 7-day and one-reply rules, the follow check, and the tools that do it."
url: https://rizamo.com/guides/instagram-comment-auto-dm/
---

# How to auto-reply to Instagram comments with a DM

To auto-reply to an Instagram comment with a DM, you send a private reply: a message to the person who commented, addressed by the comment's ID, through Meta's [private replies API](https://developers.facebook.com/docs/instagram-platform/private-replies). Your account can send one private reply per comment, within 7 days of the comment, and that is what every "comment GUIDE and get the link" tool is built on.

There are three ways to set it up:

- **Meta's API yourself:** a webhook or a poll that finds new comments, a keyword match, and one call per private reply. Free, and what most of this guide covers.
- **A chat marketing tool** such as [ManyChat](https://manychat.com/), if you want a visual flow builder and no code. [Comment-to-DM tools](/guides/instagram-comment-to-dm-tools/) compares seven of them.
- **A social media API with comment automations**, such as Rizamo, if your agent or your app should create them through an API or MCP server.

## The short version

1. Use a business or creator account, connected to a Meta app with the messaging and comments permissions.
2. Find new comments: subscribe to the `comments` webhook, or read each post's comments on a schedule.
3. Match the keyword yourself. Meta does not filter comments for you.
4. Send one private reply to the comment's ID, within 7 days of the comment.
5. If the person answers, you can keep writing to them for 24 hours after each of their messages.

## The rules Meta sets

- **One private reply per comment.** A second one fails. On the Instagram API the error is `#100` with subcode `2534025`, "The comment is invalid for a private reply", which also covers a deleted comment ([Messenger Platform error codes](https://developers.facebook.com/docs/messenger-platform/error-codes)).
- **Within 7 days of the comment** ([private replies](https://developers.facebook.com/docs/instagram-platform/private-replies)). After that the comment can no longer be answered privately.
- **Then the person decides.** Your private reply opens a conversation, but you can only write again once they reply, and then within 24 hours of their last message ([Instagram messaging API](https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/messaging-api)).
- **Short messages.** Text is at most 1,000 bytes. A button template, the usual way to send a link behind a button, takes 640 characters of text and button titles of 20 ([messaging API](https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/messaging-api)). Quick replies are not shown on desktop.
- **Business or creator accounts only.** A personal account has no API access.

## Send a private reply with curl

With Instagram Login, the token is the account's user token and `<IG_ID>` is the account's Instagram user ID:

```bash title="Private reply to one comment"
curl -X POST "https://graph.instagram.com/v26.0/<IG_ID>/messages" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "recipient": { "comment_id": "<COMMENT_ID>" },
    "message": { "text": "Here is the guide: https://example.com/guide" }
  }'
```

The answer has the `recipient_id` of the person and a `message_id`. Store the comment ID before you send: a timeout does not tell you whether the message went out, and Meta refuses a second one anyway.

## Finding the comments

- **Webhooks:** subscribe your app to the Instagram `comments` field and Meta posts each new comment to your server ([webhooks](https://developers.facebook.com/docs/instagram-platform/webhooks)). Fastest, but you need a public HTTPS endpoint that answers Meta's verification, and your app needs the permissions in Live mode.
- **Polling:** list the account's recent media and read each post's comments. Simpler to run, but slower, and on Instagram a media's comments come back in no particular order, so on a busy post you read many pages to find the new ones.

Either way, skip the account's own comments, replies inside threads, and comments you already answered. A keyword that matches whole words only (`guide`, not `guidelines`) and ignores case saves you from most wrong matches.

## Asking people to follow first

Many accounts send the link only to followers. Meta does not let you require a follow before the first message, so the usual flow is:

1. The private reply asks the person to follow and reply.
2. When they reply, check whether they follow you: the Instagram User Profile API returns `is_user_follow_business` for someone who messaged your account.
3. A follower gets the link. Someone who does not follow gets one reminder, and is checked again on their next reply.

Keep it to a few messages per person. Messaging people who did not ask reads as spam, both to them and to Meta.

## Common errors

| Error | What it means |
| --- | --- |
| `#100`, subcode `2534025` | The comment already got its private reply, or it was deleted |
| `#10` or `#200` | The token lacks a messaging or comments permission, or the app is not approved for it |
| `#190` | The token expired or was revoked: the account must log in again |
| Outside the window | More than 7 days since the comment, or more than 24 hours since the person's last message |

## What it takes in production

- **Idempotency:** one reply per comment, even when a webhook arrives twice or a poll and a webhook bring the same comment.
- **Pace:** a viral post can bring thousands of matching comments. Send at a steady pace per account, with a daily cap, or Meta and the people you message will treat it as spam.
- **Permissions:** to run this for accounts you do not own, your Meta app needs App Review for the messaging and comments permissions, with a screencast of the flow ([App Review](https://developers.facebook.com/documentation/instagram-platform/app-review)).
- **Links:** if you want to know who clicked, send your own short link or add UTM tags.

## Where Rizamo fits

Rizamo is a social media API and MCP server, and comment automations are one of its resources: "comment GUIDE and get the link in a DM", on Instagram and Facebook. Create one in the web app, through the API, or by asking your agent ("When someone comments GUIDE on my last reel, DM them the link").

| The hard part | What Rizamo does |
| --- | --- |
| Finding comments | Reads an account with an active automation every 15 minutes, so a reply goes out within about 15 minutes |
| Matching | Whole word, contains or exact; any case, with or without accents; words to exclude; one post or every post of the account |
| One reply per comment | Never sends twice, whichever read brought the comment, and one message per person by default |
| Follow gate | Instagram only: asks to follow and reply, checks the follow, sends one reminder |
| Meta's windows and pace | Sends within the 7 days, paced per account with a daily cap, and pauses with Meta's reason when a permission is refused |
| Links | Each link behind a button, counted, with UTM tags so your analytics see where visitors came from |
| Public reply | Optional, picked at random from up to 5, posted only after the private reply went out |

Automations run on Instagram and Facebook only. Rizamo is open: [start free](https://app.rizamo.com/sign-up). Free for 2 social accounts, with unlimited posts, profiles, seats and agents, and the API and MCP included. No card. The automation tools for agents: [Rizamo for agents](/agents/).
