Log inStart Free Trial
easyCoexistence Official APIs

Facebook comment-to-DM automation: send a Messenger message to people who comment on a Page post

Facebook comment-to-DM automation sends a Messenger private reply when someone comments a keyword you choose, such as MENU, under your Page's posts, plus an optional public reply; Meta allows one such message per comment, within 7 days. Through easyCoexistence, Claude, ChatGPT or your own agent sets the rule for one Page post or all of them, and it acts on matching comments around the clock.

1 message

Private replies a Page can send for one comment or visitor post; more wait until the person responds.

7 days

How long after a comment or visitor post was created its private reply can still be sent.

10900

Error Meta's Page messages reference lists as Activity already replied to.

Feed webhook

Where Meta recommends taking a comment's ID for a private reply, rather than the feed endpoint, to avoid rate limiting.

50 rules

Comment rules one Facebook Page can hold on easyCoexistence, each on one post or on all of the Page's posts.

How does comment-to-DM work on a Page?

Someone comments your keyword under a Page post, and the Messenger message goes out on its own. Behind it are two parts of Meta's API. The Page's feed webhook reports a new comment as a change with item set to comment and verb set to add, carrying comment_id, post_id, the author in from and the text in message. When the text matches, the rule sends a private reply to /{page-id}/messages, and the person receives it in Messenger with a link to the comment it replies to.

1CommentMENU under a Page post
2feed webhookitem comment, verb add
3Keyword checkAny one keyword, anywhere in the text
4Private replyOne Messenger message, linked to the comment

Which of Meta's rules shape the automation?

Meta's private replies guide fixes what one comment allows. The endpoint and its errors belong to the private replies API; for a rule, these are the limits that matter:

  • One message per comment or visitor post; trying again returns error 10900, Activity already replied to.
  • Sent within 7 days of when the comment or post was created.
  • No second message until the person answers, which opens the standard messaging window, 24 hours for most actions.
  • No private reply to another Facebook Page, so a comment made as a Page cannot get a private reply.
  • Any Send API message type is allowed, buttons included, although rules and automations send text.

What goes into a comment-to-DM rule?

Four settings, passed to create_comment_rule with the Page's account_id from list_social_accounts. The rule then replies on easyCoexistence day and night, whether or not an assistant is open:

  • keywords: any one of them triggers the rule; with none, the rule replies to the comment whatever it says. The first 50 are kept.
  • dm_text: the Messenger message, sent as written, up to 1,000 characters.
  • public_reply: optional text the Page posts under the comment after the message, cut at 500 characters.
  • post_id: one Page post; left out, the rule covers all of the Page's posts, later ones included.
  • A Page holds up to 50 rules, and when several match a comment the oldest one replies.
A rule, as the assistant creates it
create_comment_rule
{
  "account_id": "<ACCOUNT_ID>",
  "keywords": ["menu", "prices"],
  "dm_text": "Hi! Here is this week's menu: https://example.com/menu",
  "public_reply": "We sent you the menu in Messenger.",
  "post_id": "<PAGE_ID>_<POST_ID>"
}

How does a rule match keywords?

As text inside the comment's message, the same way for each rule:

  • Case does not matter: MENU, Menu and menu are the same keyword.
  • A keyword counts anywhere in the text, including inside a longer word.
  • Any one keyword is enough; a phrase such as gift card has to appear as written, spaces included.
  • Accents and emoji are compared as typed, so café and cafe are separate keywords.
  • A comment with only a photo or a sticker has no text, so only a rule without keywords replies to it.
  • Automations add two stricter matches: the keyword at the start of the comment, or as the whole comment.

Which comments does a rule reply to?

New comments that the feed webhook reports for the Page once the rule exists, within these bounds:

  • With post_id, only comments on that post, matched against the post_id in the feed change; list_social_posts gives the IDs.
  • Without post_id, comments on any of the Page's posts, its ad posts included, since Meta sends comments on ads on feed too.
  • Replies in a comment thread are comments too, so a reply with the keyword gets its own message.
  • Comments the Page writes are skipped, so its public reply never triggers the rule again.
  • Visitor posts are not comments, 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 receive the message twice, once per comment. Meta counts private replies per comment, and a rule replies to each matching comment without looking at who wrote it: it keeps a count of the comments it replied to, never the people. Automations also start one run per comment, and their AI replies are capped per person at 10 an hour by default.

The same comment arriving twice is another case. Meta retries a failed delivery for up to 36 hours and asks receivers to deduplicate; a second private reply to that comment returns error 10900, so the rule sends nothing more and skips its public reply.

When is an automation the better choice?

When the message should depend on the comment or on who wrote it, or when more should happen than a message 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 messageFixed text, up to 1,000 charactersText with {{first_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?

Their reply arrives on the messages webhook as a Messenger message from their Page-scoped ID, and it opens the standard messaging window. From there it is an ordinary conversation: a dm_received automation can take it, your agent can reply with send_social_dm within 24 hours of their latest message, or someone at the business can reply by hand. Messages the Page sends by hand do not reach easyCoexistence, so an automation does not pause when someone takes over: one set to any message keeps replying to the person's new messages. For chats people handle, use the keyword or first_message match, or switch the automation off.

How do you set it up from Claude or ChatGPT?

Describe it in plain words, for example: when someone comments BOOK on our latest post, send them the booking link in Messenger and reply Check your inbox under the comment. The assistant looks the post up with list_social_posts, shows you the wording and creates the rule. list_comment_rules then reports how many comments each rule has replied to, and update_comment_rule pauses, resumes or deletes one.

Common mistakes

  • Testing with a comment made as the Page. The Page's own comments are skipped, and Meta sends no private reply to a Page, so comment from a personal profile to see the message arrive.
  • Creating a newer rule to change the wording. The oldest matching rule keeps replying, so delete the first one with update_comment_rule before creating its replacement.
  • Choosing a keyword short enough to hide in other words. Matching is by substring, so cap also fires on capital and escape; use a distinctive word, or an automation that matches the whole comment.
  • Planning a sequence of messages from one comment. Until the person answers, the Page has a single message, so put the link or the answer in it rather than a teaser.
Doing this with EasyCoexistence

easyCoexistence lets your AI agents reach the people who comment on your Facebook Page. Comment rules, created by Claude, ChatGPT or your own agent, pair keywords with a Messenger message and an optional public reply; automations, set up the same way or in the dashboard, can have your own AI write the message. 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 a Page send a Messenger message to everyone who comments?

Yes, one private reply per new comment: a rule without keywords answers new comments on the chosen post, or on all of the Page's posts. Comments made as a Page are left out, since Meta sends no private reply to a Page, and Meta can refuse a send, for example to someone who blocked the Page.

Does the person need to have messaged the Page first?

No. Their comment is what lets the Page send the private reply; after it, the Page writes again only once they answer.

Can the Messenger message include buttons?

Meta allows any Send API message type in a private reply, buttons included. Rules and automations send text, and no tool sends a button template.

How much does easyCoexistence cost for a Facebook Page?

Each Page 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. Messages 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