Comment-to-DM API
Someone comments a keyword on an Instagram post and gets a DM with the link, the guide or the code you promised. Add a public reply so the thread shows it worked. One API call sets it up.
No card required.
POST /v1/comment-automations
{
"accountId": "int_ig_123",
"name": "Meal prep guide",
"postScope": "specific",
"platformPostId": "17998412563201",
"keywords": ["GUIDE"],
"matchMode": "word",
"publicReplies": ["Sent it to your DMs 📩"],
"dmMessage": "Here's the 5-day meal prep guide: https://priya.co/prep"
}Comments
alexkitchen Saving this for Sunday3h
jamie.eats GUIDE please!now
priya.cooks Sent it to your DMs 📩now
priya.cooksBusiness chat
Today
Here's the 5-day meal prep guide: priya.co/prep
Set it up in three calls
Automations run on Postkey's side. Your app creates them, pauses them and reads what happened.
Pick the post
List the account's recent posts, or use postScope "any" to watch every post.
GET /v1/comment-automations/posts ?accountId=int_ig_123{ "posts": [ { "platformPostId": "17998412563201", "caption": "5-day meal prep guide…" } ] }Create the automation
Keywords (up to 20), how they match, up to 5 public replies to rotate, and the DM.
POST /v1/comment-automations { "accountId": "int_ig_123", "name": "Meal prep guide", "postScope": "specific", "platformPostId": "17998412563201", "keywords": ["GUIDE"], "matchMode": "word", "publicReplies": ["Sent it to your DMs 📩"], "dmMessage": "Here's the guide: https://priya.co/prep" }{ "automation": { "id": "auto_4Qe1", "status": "active" } }Read the logs
Every trigger: who commented, what they wrote, whether the DM and the public reply went out.
GET /v1/comment-automations/auto_4Qe1/logs{ "logs": [ { "commenterName": "jamie.eats", "commentText": "GUIDE please!", "privateReplySent": true } ] }
Comment-to-DM endpoints
Same key, same connected accounts and same response shape on every network. Failed calls cost nothing.
| Call | What it does | Endpoint | Credits |
|---|---|---|---|
| Create | Keywords, match mode (exact, contains, word), words to skip, public replies and the DM | POST /v1/comment-automations | 0 |
| List | Every automation on an account, with triggered, sent and failed counts | GET /v1/comment-automations | 0 |
| Posts | Recent posts you can attach an automation to | GET /v1/comment-automations/posts | 0 |
| Pause or edit | Pause, resume or change keywords, replies or the DM | PATCH /v1/comment-automations/{id} | 0 |
| Delete | Stop and remove an automation | DELETE /v1/comment-automations/{id} | 0 |
| Logs | Each trigger with the comment, the DM status and the public reply status | GET /v1/comment-automations/{id}/logs | 0 |
| Each DM sent | Charged when the DM goes out, not when the automation runs | 1 |
Other agents
Comment-to-DM questions
Something not here? Email hello@postkey.dev. I answer every one myself.
Book a 15-minute callInstagram Business and Creator accounts.
exact matches the whole comment, contains matches anywhere, and word matches it as a separate word, so GUIDE matches "guide please" but not "guidelines". Add excludeKeywords to skip comments you don't want to answer.
1 credit per DM sent. Creating, pausing and reading logs are free.
Get your key and make the first call.
$ curl -X POST api.postkey.dev/v1/posts -H "x-access-key: …"
No card required.