Comment Automations
Send an automatic Instagram DM when a new comment matches your trigger.
Comment automations send a direct message when a new comment matches your trigger. You can target one post or every post on a connected account and add an optional public reply.
Instagram only: Comment automations currently support Instagram Business and Creator accounts. Personal accounts and other platforms are not supported.
1. Connect Instagram
Request an Instagram authorization URL:
curl https://api.postpeer.dev/v1/connect/instagram \
-H "x-access-key: YOUR_ACCESS_KEY"Redirect the user to the returned url. After authorization, list the connected accounts and save the Instagram integration's id. You will use it as accountId.
The connection needs instagram_business_manage_comments and instagram_business_manage_messages. If either permission is missing, reconnect the account to grant it. See Connect an Account for the complete OAuth flow.
2. Choose a post
To target one post, list the account's eligible Instagram posts:
curl "https://api.postpeer.dev/v1/comment-automations/posts?accountId=INTEGRATION_ID" \
-H "x-access-key: YOUR_ACCESS_KEY"Save the post's id as platformPostId. Skip this step if the automation should run on every post.
3. Create the automation
This example sends a DM and a public reply when a comment on one post contains the whole word link or guide:
curl -X POST https://api.postpeer.dev/v1/comment-automations/ \
-H "x-access-key: YOUR_ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{
"accountId": "INTEGRATION_ID",
"name": "Send the guide",
"postScope": "specific",
"platformPostId": "INSTAGRAM_POST_ID",
"keywords": ["link", "guide"],
"matchMode": "word",
"publicReplies": ["Sent you a DM!"],
"dmMessage": "Here is the guide: https://example.com/guide"
}'The automation starts active. PostPeer subscribes the account to Instagram comment events and handles matching and delivery.
- Set
postScopetoanyand omitplatformPostIdto watch every post. - Leave
keywordsempty to match every new comment. - Use
excludeKeywordsto ignore comments that contain specific words or phrases. - Set
publicRepliesto an empty array to send only the DM.
PostPeer ignores comments from the connected account itself. If several automations match, only the most specific one runs.
4. Test the automation
Comment from a different Instagram account using a matching trigger word. Confirm that the commenter receives the DM and, if configured, that the public reply appears below the comment.
For every request field and response shape, see the Create Comment Automation API reference. You can also update or pause an automation and review delivery logs.