Call it
curl https://api.peume.com/v1/call/create-comment-to-dm-automation \
-H "Authorization: Bearer $PEUME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"accountId": "your accountId",
"trigger": "comment",
"name": "your name",
"matchMode": "contains",
"linkTracking": true,
"alsoMatchInDms": false
}
}'const res = await fetch("https://api.peume.com/v1/call/create-comment-to-dm-automation", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PEUME_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"input": {
"accountId": "your accountId",
"trigger": "comment",
"name": "your name",
"matchMode": "contains",
"linkTracking": true,
"alsoMatchInDms": false
}
}),
});
const { output, cost_usd } = await res.json();import os, requests
res = requests.post(
"https://api.peume.com/v1/call/create-comment-to-dm-automation",
headers={"Authorization": f"Bearer {os.environ['PEUME_API_KEY']}"},
json={
"input": {
"accountId": "your accountId",
"trigger": "comment",
"name": "your name",
"matchMode": "contains",
"linkTracking": True,
"alsoMatchInDms": False
}
},
)
print(res.json()["output"])Answer: {"id": "run_…", "status": "completed", "cost_usd": …, "output": {…}}. Long jobs answer 202 with a run id to read later. From an AI agent, connect the MCP server and ask for this by name: create-comment-to-dm-automation.
Parameters
accountIdRequiredstringInstagram, Facebook, TikTok, Threads, LinkedIn or YouTube account ID. On the last four the automation only posts the public reply. X accounts are refused (400, code platform_not_supported) while X comment polling is off.
triggerstringWhat fires the automation: - 'comment': keyword comment on a post. - 'live_comment': keyword comment on an Instagram live broadcast. - 'story_reply': keyword reply to an Instagram story. platformPostId is the story media id (omit for any story). - 'story_mention': a story mentioning the Instagram account. Every trigger but 'comment' is Instagram only; reply-only platforms accept 'comment' only.
comment · live_comment · story_reply · story_mention
Example: comment
platformPostIdstringPlatform media/post ID (or story media id when trigger=story_reply). Omit for an account-wide (any-post / any-story) automation.
postIdstringpost ID (24 hexadecimal characters); platform IDs return 400. Optional and never required. Use it INSTEAD of platformPostId to bind a per-post automation to a not-yet-published post: the automation stays pending and arms itself when that post publishes. For a post already live on the platform, pass platformPostId alone and omit this.
postTitlestringPost content snippet for display
nameRequiredstringAutomation label
keywordsarrayTrigger keywords (empty = any comment triggers)
matchModestringHow a keyword is compared with the comment. 'contains' (default) matches anywhere, even inside another word (keyword 'app' fires on 'happy'). 'word' matches the keyword only as a standalone word. 'exact' requires the whole comment to be exactly the keyword.
exact · contains · word
Example: contains
excludeKeywordsarrayComments containing one of these never trigger the automation, even when a trigger keyword also matches. Compared using the same matchMode.
typoTolerancebooleanOnly with matchMode=word: also fire on close misspellings of a keyword (one edit for 4-7 character keywords, two from 8 up). Keywords shorter than 4 characters are never fuzzy-matched.
dmMessagestringDM text sent to the commenter. Required on Instagram and Facebook (400 missing_required_field when absent). Rejected on TikTok, Threads, LinkedIn and YouTube, which have no private reply (400 invalid_field_value). Max 640 chars when buttons are set, otherwise ~1000.
buttonsarrayOptional inline DM buttons (1-3). Phone buttons are Facebook-only. Omit or pass [] for a plain-text DM.
templatestringOptional product card sent INSTEAD of the plain dmMessage bubble. Mutually exclusive with buttons. dmMessage stays required: it is what gets sent the moment the card is cleared.
commentReplystringPublic reply to the comment. Optional on Instagram and Facebook; required on TikTok, Threads, LinkedIn and YouTube, where it is the automation's only action. On LinkedIn, mention with `@[Name](urn:li:person:ID)` or `@[Name](urn:li:organization:ID)`, getting the URN from `GET /v1/accounts/{accountId}/linkedin-mentions`. The name must match the person's or Page's LinkedIn name exactly, or the mention renders as plain text. Profile or company URL mentions are not resolved here and are sent as plain text.
dmMessageVariationsarrayOptional alternate DM texts for random rotation. When set, each triggered comment sends one picked at random from [dmMessage,...dmMessageVariations], so repeat commenters get slightly different DMs (helps avoid identical-message patterns). Up to 5. Buttons are attached to whichever text is picked, not varied.
commentReplyVariationsarrayOptional alternate public replies, rotated at random alongside commentReply (picked independently of the DM). Up to 5. LinkedIn mentions follow the commentReply rules.
linkTrackingbooleanWrap link buttons in the DM in a tracked redirect so clicks are counted (Link Clicks / CTR). Pass false to send links exactly as written. Defaults to on.
Example: true
clickTagstringOptional tag applied to a contact when they click a tracked link (requires linkTracking). Lets you segment clickers for broadcasts/sequences.
dmDelaySecondsintegerSeconds to wait after the trigger before sending the DM. Omit or send 0 to reply immediately (the default). Max 86400 (24h). The trigger is still matched and deduplicated the moment the comment arrives, so a delay only moves when the response is sent.
commentReplyDelaySecondsintegerSeconds to wait before posting the public comment reply. Omit or send 0 to post it right after the DM (the default). The reply never goes out before the DM, so a value below dmDelaySeconds is raised to it. Ignored when trigger=story_reply, which has no public reply.
alsoMatchInDmsbooleanAlso fire these keywords on a plain inbound DM, so the automation answers people who message the keyword instead of commenting it. - Requires at least one keyword (an empty list means 'match anything', which would answer every inbound message). - Rejected on story_reply automations, which already trigger on DMs. - Dedup is per door: a contact who already received the DM from their comment can still receive it from a DM.
Example: false
audienceobjectaudience
followGateobjectfollowGate
repeatPolicyobjectrepeatPolicy
dedupeSameTextHoursintegerSkip the DM when this recipient already received identical DM text (after personalisation) from this account, from any automation, within this many hours. The skip is logged with status skipped.
publicReplyPolicystring'after_dm' posts commentReply only after a successful DM. 'always' posts it whatever the audience rule, dedupe or DM outcome: the moment a comment matches, or after commentReplyDelaySeconds when set (raised to dmDelaySeconds, so it never precedes the DM attempt).
after_dm · always
Example: after_dm
actionsobjectactions
quickRepliesarrayOpt-in quick-reply chips on the DM (up to 13). Chips do not render in Message Requests, where a first DM to a cold commenter lands, so prefer buttons for first contact. Mutually exclusive with buttons and template (400).
dmMediastringisActivebooleanCreate the automation paused with false. Once switched on, it answers only comments posted from that moment.
Example: true
