Log inStart Free Trial
easyCoexistence Official APIs

Instagram comment-to-DM automation: send a DM when someone comments a keyword

Instagram comment-to-DM automation sends a DM to each person who comments a keyword you choose, such as GUIDE, on your post or Reel, with an optional public reply under the comment. On easyCoexistence, Claude, ChatGPT or your own agent sets the keywords, the message and the posts once, and the rule replies around the clock; an automation can tailor the DM or have your own AI write it.

1 per comment

Private replies Meta allows for one comment; more DMs wait until the person responds, then go out within 24 hours.

7 days

How long after a comment on a post or Reel its private reply can still be sent; on a Live, only during the broadcast.

750 an hour

Private replies to post and Reel comments Meta allows per Instagram professional account.

1,000 bytes

The most text an Instagram DM can carry through the API, in UTF-8, which emoji and accents fill faster.

50 rules

Comment-to-DM rules one Instagram account can hold on easyCoexistence, each with a DM of up to 1,000 characters.

How does comment-to-DM work on Instagram?

Someone comments your keyword, and the DM goes out on its own. Behind it are four moves: the comment lands on the account's post or Reel; Meta's comments webhook reports it with the comment's ID, its text and the author's Instagram-scoped ID and username; the rule looks for a keyword in the text; and a match gets a private reply through the API, a DM that links back to the post. Once the person answers that DM, it becomes an ordinary conversation.

1CommentGUIDE under a Reel
2comments webhookThe comment's ID, text and author
3Keyword checkAny one keyword, anywhere in the text
4Private replyOne DM to the commenter, linked to the post

What does Meta let a comment-to-DM rule send?

Through Meta's API, a DM to someone who has only commented is a private reply, and Meta's rules for it shape what a rule can send. The endpoint and its errors belong to the private replies API; for setting up a rule, these are the limits that matter:

  • One DM per comment: a second private reply to the same comment is refused.
  • Sent within 7 days of the comment; for a Live, only while the broadcast lasts.
  • Nothing more until the person answers, and then replies within 24 hours of their response.
  • Up to 750 private replies an hour per account for comments on posts and Reels.
  • DM text in UTF-8, no longer than 1,000 bytes.
  • Only comments on the account's own posts, Reels, Stories, Lives and ad posts.

What goes into a comment-to-DM rule?

Four settings, passed to create_comment_rule with the account_id from list_social_accounts. From then on the rule runs on easyCoexistence around the clock, with no assistant open:

  • keywords: any one of them triggers the rule; leave them out and it replies to each comment, whatever it says. The first 50 are kept.
  • dm_text: the DM, sent exactly as written, up to 1,000 characters.
  • public_reply: optional text posted under the comment once the DM has gone, cut at 500 characters.
  • post_id: one post or Reel; left out, the rule covers all of the account's posts, including ones published later.
  • An account holds up to 50 rules. When several match a comment, the oldest replies, and the comment gets one DM.
A rule, as Claude or ChatGPT creates it
create_comment_rule
{
  "account_id": "<ACCOUNT_ID>",
  "keywords": ["guide", "link"],
  "dm_text": "Hi! Here is the guide you asked for: https://example.com/guide",
  "public_reply": "Sent you a DM!",
  "post_id": "<MEDIA_ID>"
}

How does a rule match keywords?

By looking for each keyword inside the comment's text, with no other processing:

  • Capital letters do not matter: GUIDE, Guide and guide all match guide.
  • A keyword matches anywhere in the text, including inside a longer word.
  • Any one keyword is enough, and a phrase such as send it has to appear as written, spaces included.
  • Accents and emoji are compared as typed, so preço and preco are separate keywords; add both if your audience writes both.
  • Only text counts: a comment with no text matches only a rule without keywords.
  • Automations can match more strictly: the keyword at the start of the comment, or as the whole comment.

Which comments does a rule reply to?

New comments that the comments webhook reports for the account from the moment the rule exists, within these bounds:

  • With post_id, only comments on that post or Reel, matched against the media ID in the event; list_social_posts gives the IDs.
  • Without post_id, comments on any media of the account that Meta reports, Stories and ad posts included.
  • Replies in a comment thread count as comments, so a reply with the keyword gets its own DM.
  • The account's own comments are skipped, so the rule's public reply never triggers it again.
  • Comments during a Live arrive on live_comments, a field easyCoexistence does not subscribe to, so rules leave them alone.
  • A comment a rule replied to, or tried to, is not passed on to automations.

What happens when the same person comments twice?

They get the DM twice, once for each comment. Meta's limit is one private reply per comment rather than per person, and a rule replies to each matching comment on its own: it counts the comments it replied to and keeps no list of who wrote them. Automations behave the same way, starting one run per comment, with AI replies capped per person at 10 an hour by default.

One comment delivered twice is a different case. Meta tells receivers to expect duplicate deliveries and notes that comments on boosted or ad posts can produce them. Meta refuses a second private reply to the same comment, so the rule sends no second DM and skips its public reply, and an automation starts only once per comment ID.

When is an automation the better choice?

When the DM should depend on the comment or on who wrote it, or when more should happen than a DM and a public reply. An automation starts on comment_received, for any comment or for keywords, on one post or all of them, and runs up to 12 steps in a line. The assistant creates it with create_automation, or you start one in the dashboard under Automations from the Comment to DM example.

Comment ruleAutomation
Created withcreate_comment_rule, from your AIcreate_automation, or Automations in the dashboard
Keyword matchAnywhere in the commentAnywhere, at the start, or the whole comment
The DMFixed text, up to 1,000 charactersText with {{name}} or {{message}} filled in, or written by your own AI
Public replyOptional fixed textA reply_comment step
More stepsNoneHide the comment, call your webhook, wait up to 1,380 minutes
OrderRuns firstTakes the comments no rule replied to

What happens after the person answers the DM?

Their answer reaches the account as a DM on the messages webhook, from the same Instagram-scoped ID the comment came from, and opens the standard 24-hour window. From then on it is a normal conversation: a dm_received automation can take it, your agent can reply with send_social_dm, or someone can answer in the Instagram app.

How do you set it up from Claude or ChatGPT?

Describe it in plain words, for example: when someone comments GUIDE on my newest Reel, DM them the link to the guide and reply Sent you a DM under the comment. The assistant finds the Reel with list_social_posts, shows you the wording, and creates the rule. list_comment_rules then shows how many comments each rule has replied to, and update_comment_rule pauses, resumes or deletes one.

Common mistakes

  • Testing with a comment from the account itself. Its own comments are skipped, so nothing is sent; comment from another account to see the DM arrive.
  • Creating a second rule to change the wording. The oldest matching rule keeps replying, so delete the first one with update_comment_rule, then create the new one.
  • Choosing a short keyword. Matching is by substring, so pin also fires on pink and spin; use a distinctive word, or an automation that matches the whole comment.
  • Filling the DM to the 1,000-character cap with emoji or accents. Meta counts 1,000 bytes, and accented letters take two bytes each and most emoji four or more, so the send can fail.
Doing this with EasyCoexistence

easyCoexistence lets your AI agents reach the people who comment on your Instagram posts. Comment rules, created by Claude, ChatGPT or your own agent, pair keywords with a DM and an optional public reply; automations, set up the same way or in the dashboard, can have your own AI write the DM. Both reply around the clock with no chat open. US$ 9 to US$ 0.75 per connection per month, falling as you add connections, with the first 3 days free.

easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.

Frequently asked questions

Can I DM everyone who comments on a post?

Yes. A rule without keywords sends its DM to the author of each new comment on the chosen post, or on all posts, one per comment, leaving out comments during a Live and the account's own. Meta allows up to 750 private replies an hour per account.

Does a new rule reply to comments made before it was created?

No. Rules act on comments as Meta reports them. An older comment can still get a private reply within 7 days of it, through reply_to_comment with private set to true.

Can the DM use the commenter's name?

Not from a rule, which sends its text as written. An automation's DM can include {{name}}, filled in with the commenter's username, or be written by your own AI from the comment.

How much does easyCoexistence cost for an Instagram account?

Each Instagram account is one connection, at US$ 9 to US$ 0.75 per connection per month, the price falling as you add connections, and the first 3 days are free. DMs written by AI run on your own Anthropic, OpenAI or OpenRouter key.

Keep reading

Connect your first channel in two minutes.

No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.

  • 3 days free
  • Cancel any time
  • Official APIs only
  • Monitored 24/7

Verified on