How to automate Instagram comment replies with an API
October 28, 2026 · Zoosial team
You create one automation with POST /automations: the connected account, the keywords to watch, and the private message to send. When someone comments a matching keyword on your Instagram or Facebook post, the API sends them a direct message and, optionally, a short public reply. It runs on the official Meta APIs, with no scraping.
How comment-to-DM works
This is the pattern often called "comment to get the link". A post says "comment INFO and I'll send the catalog". Each person who comments the keyword gets a private message with the catalog, and the comment can also get a public reply such as "Sent you a message!". Here it is a plain API resource you can create, list, edit and delete from code.
Create the automation
You need a connected Facebook Page or Instagram account (connect it once from the dashboard) and an API key. Then:
POST /automations
{
"accountId": "acc_...",
"platform": "instagram",
"platformPostId": "optional post id",
"keywords": ["info", "price"],
"dmMessage": "Hi {nombre}, here is the catalog: https://...",
"publicReply": "Sent you a message!",
"active": true
}
platformisfacebookorinstagram.- Without
platformPostId, the automation applies to the whole account. With it, only to that post. - Without
keywords, it applies to every comment. With several, any of them triggers it. dmMessageandpublicReplyaccept{nombre}, the commenter's first name. Instagram does not send the name, so on Instagram the placeholder is removed.
To manage it later use GET /automations, PATCH /automations/:id and DELETE /automations/:id. To stop it for good, delete it; you can also create it with active set to false.
Know when it fires
Subscribe a webhook with POST /hooks and you receive signed events:
| Event | When |
|---|---|
comment.received | Any new comment on a connected account (except the account's own comments), with or without an automation |
automation.triggered | An automation fired; carries automationId, commentId, commenterId, commenterName |
That is how you save "who asked for the catalog" to your CRM. Meta retries its own webhooks, so deduplicate comment.received by commentId.
If your own bot already replies
If your system answers messages on the same account, declare it with PUT /accounts/:id/automation-priority. While that exists, Zoosial's automations on the account do not fire, but comment.received keeps arriving. Automations created in Meta Business Suite cannot be switched off through the API; turn those off by hand in Business Suite.
Limits to plan around
- Meta allows one private message per comment, and only to the person who commented on your post.
- It works on Facebook and Instagram only.
- Meta decides whether a message is delivered. Platform rules still apply; for example, Messenger's 24-hour window answers 422 on replies outside it unless Meta has approved the Human Agent feature for the app.
Let an AI agent set it up
The MCP server exposes list_automations, create_automation and delete_automation (deleting asks for confirmation). In Claude, ChatGPT or Codex you can say "create an automation on my post: keyword INFO, send the price list". Add it with claude mcp add --transport http zoosial https://zoosial.com/mcp.
Read the full contract
The exact fields live in /llms.txt and the catalog in /openapi.json; both use English field names. The step-by-step guides under /docs are in Spanish today. Product page: Comentario a mensaje (Spanish). English landing page: /en. You can create a free account to try it.
FAQ
How do I auto-reply to Instagram comments with a DM?
Create a comment-to-DM automation: POST /automations with your account, a keyword list and the dmMessage. When a comment contains the keyword, the commenter gets a private message, and a public reply if you set publicReply.
Can I trigger the DM only on one post?
Yes. Pass platformPostId and the automation applies to that post only. Leave it out to cover the whole account.
Does the person need to follow me to get the message?
Meta decides whether the message is delivered. Someone who comments on your post can receive the private message under Meta's rules.
Can I stop the automation?
Yes. Delete it with DELETE /automations/:id, or manage it with PATCH /automations/:id. You can also create it with active set to false.