Get automation details
Returns an automation with its configuration, stats, and recent trigger logs.
API key authentication - use your Zernio API key as a Bearer token
In: header
Path Parameters
Response Body
application/json
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.commentautomations.getCommentAutomation({ path: { automationId: 'automation_abc123', },});console.log(data);{
"success": true,
"automation": {
"id": "string",
"name": "string",
"platform": "string",
"trigger": "comment",
"accountId": "string",
"platformPostId": "string",
"postId": "string",
"postTitle": "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",
"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",
"updatedAt": "2019-08-24T14:15:22Z"
},
"logs": [
{
"id": "string",
"commentId": "string",
"commenterId": "string",
"commenterName": "string",
"commentText": "string",
"source": "comment",
"status": "pending",
"audienceOutcome": "passed",
"commenterIsFollower": true,
"commenterFollowerCount": 0,
"error": "string",
"commentReplyStatus": "sent",
"commentReplyError": "string",
"nextDueAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z"
}
]
}{
"error": "Unauthorized"
}{
"error": "Not found"
}Create comment-to-DM automation POST
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.
Update automation settings PATCH
Update an automation's keywords, DM message, inline buttons, comment reply, or active status. Pass `buttons: []` to clear all buttons. When `buttons` is non-empty, `dmMessage` (the new one if you're changing it, otherwise the stored one) must be 640 characters or less.