Log inStart Free Trial
easyCoexistence Official APIs

How to add comment-to-DM to your SaaS on Instagram and Facebook

A SaaS adds comment-to-DM with one easyCoexistence call per customer channel, POST /channels/{id}/automations: a comment_received trigger with a keyword, a reply_text step that DMs the commenter on Instagram or Messenger, and an optional public reply_comment. It runs on easyCoexistence's Meta-reviewed app, so there is no App Review on your side, and it is priced per connected account, not per contact.

easyCoexistence is social media infrastructure for AI agents: its Partner API connects your customers' WhatsApp, Instagram, Facebook and TikTok accounts to your product, with no app review on your side.

1 per comment

Private replies Meta allows for one comment; more messages wait until the person answers.

7 days

How long after a comment on a Facebook Page its private reply on Messenger can still be sent.

750 an hour

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

1,000 characters

Longest DM easyCoexistence sends from a comment-to-DM rule or automation on Instagram or Facebook.

60 tests

Dry runs an account can make in an hour with POST /automations/{id}/test, which sends nothing.

US$ 0.05

What ManyChat Pro charges for each active contact over 2,500 in a month, on monthly billing.

What does comment-to-DM look like inside your product?

Like the feature people know from ManyChat, under your product's name. Your customer picks a post or any post, a keyword such as GUIDE, the DM text and an optional public reply, in your interface. Your backend turns that into one automation on their channel, and easyCoexistence runs it around the clock: when a comment carries the keyword, the commenter gets the DM from your customer's own account, as an Instagram DM or a Messenger message from their Facebook Page, and the comment gets the public reply. Your product keeps the editor, the reporting and the pricing. easyCoexistence keeps the Meta Tech Provider app, the tokens and the webhook, so your customers connect without your app going through Meta's App Review.

1CommentSomeone writes GUIDE under your customer's post
2Matchcomment_received with the keyword, on one post or any
3DMreply_text: an Instagram DM or a Messenger message
4Public replyreply_comment under the comment, if you add one
5LogThe run and each step's output, kept 30 days

What does the API request look like?

One POST to /channels/{id}/automations per rule, on the channel_id of the customer's Instagram account or Facebook Page. The trigger is comment_received with match keyword, a list of keywords and a keyword_mode of contains, starts_with or exact, and capital letters do not matter; add post_id to limit it to one post. On Instagram, a post published through the posts API gives that ID as its network_post_id. Steps run top to bottom: reply_text is the private reply, and reply_comment the public one. Put the DM first, because a failed step ends the run, so the public "Sent you a DM!" only appears once the DM went out. The answer is 201 with the automation, live at once unless you send enabled false:

Comment GUIDE, get the guide by DM
curl -X POST https://easycoexistence.com/api/v1/channels/<channel_id>/automations \
  -H "Authorization: Bearer ec_live_..." -H "Content-Type: application/json" \
  -d '{
    "name": "Comment GUIDE, get the guide by DM",
    "trigger": { "type": "comment_received", "match": "keyword", "keywords": ["guide"], "keyword_mode": "contains" },
    "steps": [
      { "type": "reply_text", "text": "Hi {{first_name}}! Here is the guide: https://example.com/guide" },
      { "type": "reply_comment", "text": "Sent you a DM!" }
    ]
  }'

How does it differ between Instagram and Facebook?

Only in where the person reads the message. Meta's private reply is the same call on both networks, a message addressed to the comment's ID rather than to a person, so one automation shape serves both and your interface needs one editor. Meta allows one private reply per comment on each network, and the conversation opens properly when the person answers: from then on a normal 24-hour window applies, so a later step or another automation can keep writing to them. On Instagram, the account must also allow access to messages in the Instagram app's settings, or the DM fails:

InstagramFacebook Page
Private replyA DM in the person's Instagram inboxA Messenger message from the Page
Public replyUnder the comment, with reply_commentUnder the comment, with reply_comment
WindowOne reply, within 7 days of the commentOne message, within 7 days of the comment
After they answerA 24-hour window for more DMsA 24-hour window on Messenger
AccountBusiness or Creator, messages access allowedA Page where the person is admin or has a task

How do you test a rule and see what it did?

Before launch, with a dry run. POST /automations/{id}/test with a sample comment such as {"text": "guide please"} runs the steps without sending anything and answers with the run: test true, and each step's status and output, so your interface can preview the DM your customer is about to send. An account gets 60 tests an hour. A safe launch is to create the automation with enabled false, test it, then PATCH /automations/{id} with {"enabled": true}. After launch, GET /automations/{id}/runs lists what it did on each matching comment, newest first, kept 30 days, with each step's status ok, failed or skipped, its output or error and how long it took. skip_reason says why a run did not answer, and your events URL receives automation.run_failed with the failed step, never what anyone wrote.

What limits apply to the DM and the rules?

Some are Meta's and some are easyCoexistence's, and each one tells your editor what to allow:

  • DM length: an Instagram DM or a Messenger message goes out at up to 1,000 characters; the API saves a longer reply_text, but the message is cut there.
  • One private reply per comment, within 7 days of it, so the API refuses a second DM step before the person answers.
  • Per automation: up to 30 keywords and 60 steps. When several automations match a comment, a keyword match wins over one that answers any comment.
  • Comment rules: easyCoexistence's MCP server also makes simpler keyword rules, up to 50 per Instagram account or Facebook Page. A rule answers before any automation, so one comment never gets two private replies.

Why is it priced per account and not per contact?

Because easyCoexistence bills connections. Each Instagram account or Facebook Page your customers connect is one connection at US$ 9 to US$ 0.75 a month, by the band of your total connections, with comment-to-DM, posting and webhooks included however many people comment. ManyChat prices by active contacts instead: its Pro plan is US$ 39 a month on monthly billing for 2,500 of them, plus US$ 0.05 for each one past that. A post that takes off raises a contact-priced bill, while here it costs the same connection, which gives your product a fixed cost per customer account to price its own plans against. Meta's own cap still applies on top: 750 private replies an hour per Instagram professional account.

How to set it up

  1. Connect the accountCreate a connect session with channel instagram or facebook and keep the channel_id your customer returns with.
  2. Build the rule in your interfaceCollect the keyword, one post or any post, the DM text and an optional public reply from your customer.
  3. Create the automationPOST /channels/{id}/automations with comment_received, match keyword, a reply_text step, a reply_comment step and enabled false.
  4. Test itCall POST /automations/{id}/test with a sample comment, check each step's output, then PATCH enabled to true.
  5. Watch the runsRead GET /automations/{id}/runs for your customer's reports and handle automation.run_failed on your events URL.

Common mistakes

  • Putting two DM steps on one comment. Meta allows one private reply per comment, so the API refuses a second reply_text; anything more waits until the person answers.
  • Writing a DM over 1,000 characters. The API saves it, but the message goes out cut at 1,000 characters, so keep the link and the offer near the start.
  • Forgetting Instagram's message setting. If the account does not allow access to messages in the Instagram app, the private reply fails, so ask your customer to turn it on when they connect.
  • Expecting it to answer old comments. An automation runs on comments that arrive after it is switched on, and Meta stops private replies 7 days after a comment.
Doing this with EasyCoexistence

easyCoexistence runs comment-to-DM inside your product: your backend creates the keyword automation on each customer's Instagram account or Facebook Page, and easyCoexistence sends the DM or Messenger message and the public reply, logs each run and keeps the Meta app, the tokens and the webhooks on its side. 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, Google Business Profile 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

Is this a ManyChat alternative for my own SaaS?

For comment-to-DM, yes: the same feature runs under your product's name through the API, on Instagram and Facebook, billed per connected account rather than per contact, with posting and webhooks on the same key.

Can the DM be written by AI?

Yes. Use ai_reply instead of reply_text, which writes the private reply with your own Anthropic, OpenAI or OpenRouter key saved in the easyCoexistence dashboard, or call_webhook, whose {"reply"} your own model returns.

Does easyCoexistence keep the comments?

On an account with automations, comments pass through easyCoexistence so the flow can run, and conversations are kept for the period the account chooses: 30, 90 or 365 days. Without automations, comments forwarded to your webhook leave no copy.

How much does comment-to-DM cost through easyCoexistence?

Nothing on top of the connection: each connected account costs US$ 9 to US$ 0.75 a month, by the band of your total connections, with the first 3 days free.

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