Zernio
Zernio
API Reference

Comment Automations

List automation logsGETList comment-to-DM automationsGETCreate comment-to-DM automationPOSTGet automation detailsGETUpdate automation settingsPATCHDelete automationDELETE
Dashboard
llms.txtOpenAPI
OverviewPlatformsAPI ReferenceResources
Comment Automations

Create comment-to-DM automation

Create a keyword-triggered DM automation on an Instagram or Facebook account. When someone comments a matching keyword (or, with trigger: story_reply, replies to your Instagram story with one), they automatically receive a DM.

Triggers (trigger):

  • comment (default): fires on keyword comments on a post or reel.
  • story_reply: fires when someone replies to your Instagram story with a keyword, and answers them with a DM. Set platformPostId to a story media id to scope to one story, or omit it to match replies to any story.

Targeting (comment trigger):

  • Per-post: set platformPostId to scope to one specific post (only one active per-post automation is allowed per post).
  • Account-wide ("any post"): omit platformPostId (and postId). The automation evaluates every comment on every post on the account. You can stack unlimited account-wide automations, each with its own keyword set, and they all run independently. Per-post automations take priority on their post.

Audience (audience, Instagram only): restrict the automation to followers or non-followers, and/or to accounts above a follower count. Instagram only reveals the follow relationship for people who have messaged the account, so audience.whenUnknown decides what happens for everyone else - including verify, which sends a one-tap confirmation DM (followGate) and then delivers the real DM automatically. People we already know follow you skip the tap entirely.

Set alsoMatchInDms: true on a comment automation to also answer people who send a keyword as a direct message instead of commenting it. One automation then covers both doors, and each door is deduplicated separately (someone who already got the DM from their comment still gets it if they later DM the keyword). Requires at least one keyword.

Links in the DM's buttons can be click-tracked (linkTracking, on by default) and clickers optionally tagged (clickTag) for segmentation. Stats returned include delivered, read, and link clicks.


POST
/v1/comment-automations

Authorization

bearerAuth
AuthorizationBearer <token>

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

{  "success": true,  "automation": {    "id": "string",    "name": "string",    "platform": "string",    "trigger": "comment",    "platformPostId": "string",    "keywords": [      "string"    ],    "matchMode": "exact",    "excludeKeywords": [      "string"    ],    "typoTolerance": true,    "dmMessage": "string",    "buttons": [      {        "type": "url",        "title": "string",        "url": "http://example.com",        "payload": "string",        "phone": "string"      }    ],    "template": {      "type": "generic",      "imageAspectRatio": "horizontal",      "elements": [        {          "title": "string",          "subtitle": "string",          "imageUrl": "http://example.com",          "buttons": [            {              "type": "url",              "title": "string",              "url": "http://example.com",              "payload": "string"            }          ]        }      ]    },    "commentReply": "string",    "dmMessageVariations": [      "string"    ],    "commentReplyVariations": [      "string"    ],    "linkTracking": true,    "clickTag": "string",    "dmDelaySeconds": 0,    "commentReplyDelaySeconds": 0,    "audience": {      "followerStatus": "any",      "minFollowerCount": 0,      "whenUnknown": "send"    },    "followGate": {      "message": "string",      "buttonLabel": "string",      "notFollowingMessage": "string"    },    "alsoMatchInDms": true,    "isActive": true,    "stats": {      "totalTriggered": 0,      "totalSent": 0,      "totalFailed": 0    },    "createdAt": "2019-08-24T14:15:22Z"  }}
Was this page helpful?

List comment-to-DM automations

List all comment-to-DM automations for a profile. Returns automations with their stats.

Get automation details

Returns an automation with its configuration, stats, and recent trigger logs.

profileId*string
accountId*string

Instagram or Facebook account ID

trigger?string

What fires the automation. 'comment' (keyword comment on a post) or 'story_reply' (keyword reply to an Instagram story). For 'story_reply', platformPostId is the story media id (omit for any story).

Default"comment"

Value in

  • "comment"
  • "story_reply"
platformPostId?string

Platform media/post ID (or story media id when trigger=story_reply). Omit for an account-wide (any-post / any-story) automation.

postId?string

Zernio post 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 Zernio 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.

Match^[a-fA-F0-9]{24}$
postTitle?string

Post content snippet for display

name*string

Automation label

keywords?array<string>

Trigger keywords (empty = any comment triggers)

matchMode?string

How 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.

Default"contains"

Value in

  • "exact"
  • "contains"
  • "word"
excludeKeywords?array<string>

Comments containing one of these never trigger the automation, even when a trigger keyword also matches. Compared using the same matchMode.

typoTolerance?boolean

Only 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.

dmMessage*string

DM text to send to commenter. Max 640 chars when buttons are set, otherwise ~1000.

buttons?array<>

Optional inline DM buttons (1-3). Phone buttons are Facebook-only. Omit or pass [] for a plain-text DM.

Itemsitems <= 3
template?

Optional 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.

commentReply?string

Optional public reply to the comment

dmMessageVariations?array<string>

Optional 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.

Itemsitems <= 5
commentReplyVariations?array<string>

Optional alternate public replies, rotated at random alongside commentReply (picked independently of the DM). Up to 5.

Itemsitems <= 5
linkTracking?boolean

Wrap 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.

Defaulttrue
clickTag?string

Optional tag applied to a contact when they click a tracked link (requires linkTracking). Lets you segment clickers for broadcasts/sequences.

dmDelaySeconds?integer

Seconds 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.

Range0 <= value <= 86400
commentReplyDelaySeconds?integer

Seconds 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.

Range0 <= value <= 86400
alsoMatchInDms?boolean

Also 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 keyword list means 'match anything', which would answer every inbound message) and is 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.

Defaultfalse
audience?

Who a comment automation answers. Instagram only - Meta exposes the follow relationship on no other platform, and only for people who have MESSAGED the account (a comment grants no consent). whenUnknown is therefore the important setting: it decides what happens for a first-time commenter.

followGate?

Copy for the follow gate. Sensible defaults are used for any field left empty.