Automations
Comment-to-DM and story-reply automation rules with keyword matching.
Keyword automations on Instagram and Facebook. Two triggers are supported:
| Trigger | When it runs | Response |
|---|---|---|
comment | A comment matches your keywords | Optional public reply + private DM to the commenter |
story_reply | Someone replies to your story with matching text | Direct message via the Messaging Send API |
Live ingestion
Comment and story-reply automations run automatically from Meta webhooks. Use POST /automations/comment-to-dm/:id/test to validate without waiting for a live event.
Create a comment automation
curl -X POST https://api.aetherhq.dev/v1/automations/comment-to-dm \
-H "Authorization: Bearer $AETHER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"profileId": "prof_ig123",
"name": "Guide keyword DM",
"trigger": "comment",
"keywords": ["guide", "ebook"],
"matchMode": "contains",
"dmMessage": "Thanks for commenting! Here is your guide: https://example.com/guide",
"commentReply": "Check your DMs!"
}'DM buttons in private replies
Attach 1–3 inline buttons to the private DM (url opens a link; postback sends a payload back to your webhook). Button titles are limited to 20 characters.
When buttons are set, dmMessage must be 640 characters or fewer (Meta button template limit).
curl -X POST https://api.aetherhq.dev/v1/automations/comment-to-dm \
-H "Authorization: Bearer $AETHER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"profileId": "prof_ig123",
"name": "Guide with CTA",
"keywords": ["guide"],
"matchMode": "contains",
"dmMessage": "Thanks! Tap below for your guide:",
"buttons": [
{ "type": "url", "title": "Get guide", "url": "https://example.com/guide" }
]
}'Facebook reconnect
Private replies use the Messenger /messages API. Facebook profiles connected before this feature need OAuth reconnect to grant pages_messaging. See Facebook platform guide.
Create a story-reply automation
Set "trigger": "story_reply". Do not set commentReply — story replies are answered with a DM only.
curl -X POST https://api.aetherhq.dev/v1/automations/comment-to-dm \
-H "Authorization: Bearer $AETHER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"profileId": "prof_ig123",
"name": "Story link DM",
"trigger": "story_reply",
"platformPostId": "1791234567890",
"keywords": ["link"],
"matchMode": "contains",
"dmMessage": "Here is the link: https://example.com"
}'Omit platformPostId to match story replies on any active story for the profile. Set it to scope the rule to one story media ID.
Facebook story replies
Instagram webhooks reliably include reply_to.story.id. Facebook Page messaging may omit story metadata, so auto-triggering story_reply automations on Facebook is best-effort. Manual tests with recipientId always work.
const automation = await client.automations.createCommentToDm({
profileId: "prof_ig123",
name: "Story link DM",
trigger: "story_reply",
keywords: ["link"],
matchMode: "contains",
dmMessage: "Here is your link: https://example.com",
});Match modes
| Mode | Behavior |
|---|---|
contains | Text contains any keyword (case-insensitive) |
exact | Text exactly matches a keyword |
Scope to a post or story
Set platformPostId to run the automation only for a specific post (comments) or story media ID (story replies). Omit to match account-wide.
Test manually
Comment trigger — requires commentId:
curl -X POST https://api.aetherhq.dev/v1/automations/comment-to-dm/{id}/test \
-H "Authorization: Bearer $AETHER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platformPostId": "1791234567890",
"commentId": "1789876543210",
"commentText": "I want the guide"
}'Story-reply trigger — requires recipientId (IGSID or Facebook PSID), not commentId:
curl -X POST https://api.aetherhq.dev/v1/automations/comment-to-dm/{id}/test \
-H "Authorization: Bearer $AETHER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platformPostId": "1791234567890",
"commentText": "send me the link",
"recipientId": "1234567890"
}'Private reply API
For one-off private replies without an automation rule (comment trigger only):
curl -X POST https://api.aetherhq.dev/v1/inbox/comments/{platformPostId}/{commentId}/private-reply \
-H "Authorization: Bearer $AETHER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"profileId": "prof_ig123",
"message": "Thanks for reaching out!"
}'Webhook events
| Event | When |
|---|---|
inbox.comment_received | A comment is ingested |
inbox.story_reply_received | A story reply is ingested |
automation.triggered | An automation runs successfully (includes trigger field) |
See Automations API.