Automations

Create Inbox Automation

Creates a keyword auto-reply rule for an Instagram or Facebook connection.

POST
/v1/automations

Authorization

headerx-api-key<token>

Workspace API key, sent in the x-api-key header. Keys start with op_ and are created in the dashboard.

Request Body

application/json
  1. body
accountId*string
Length1 <= length
kind*string
Value in"comment_to_dm""story_reply""welcome_dm"
name*string

Label for the rule.

Length1 <= length <= 120
keywords*array<>

The rule runs when a comment or message contains any of these words. Matching ignores case.

Items1 <= items <= 20
excludeKeywords?array<>

The rule is skipped when a comment or message contains any of these words.

Itemsitems <= 20
dmMessage*string
Length1 <= length <= 1000

Response Body

Created rule

application/json
  1. response
accountId*string
rule*
Example Request
import { Configuration, EngagementApi } from "@onepostly/sdk";const engagementApi = new EngagementApi(  new Configuration({ apiKey: process.env.ONEPOSTLY_API_KEY }));const response = await engagementApi.createAutomation({  createAutomationBody: {    "accountId": "string",    "kind": "comment_to_dm",    "name": "string",    "keywords": [      "string"    ],    "dmMessage": "string"  },});console.log(response);
Example Response
{  "accountId": "string",  "rule": {    "id": "string",    "name": "Free guide giveaway",    "kind": "comment_to_dm",    "keywords": [      "guide",      "free"    ],    "excludeKeywords": [      "guidelines"    ],    "dmMessage": "Thanks for your interest! Here is your guide.",    "enabled": true  }}