Automations

Update Automation

Changes a rule. Only the fields you send change. Send enabled false to pause it.

PATCH
/v1/automations/{id}

Authorization

Bearer
headerAuthorizationBearer <op_>

Workspace API key, sent as Authorization: Bearer op_... Keys are created in the dashboard.

Path Parameters

id*string
Length1 <= length

Request Body

application/json
  1. body
name?string

Label for the rule.

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

Replaces the keywords. The rule runs when a comment or message contains any of them.

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

Replaces the excluded keywords. Send an empty list to remove them.

Itemsitems <= 20
message?string

The direct message the rule sends.

Length1 <= length <= 1000
enabled?boolean

false pauses the rule, true resumes it.

Response Body

Updated automation

application/json
  1. response
id*string
accountId*string
name*string

Label for the rule.

kind*|

comment_to_dm answers a comment with a direct message. story_reply answers a reply to a story. welcome_dm answers a message. New values can be added, so handle a value you do not know.

keywords*array<string>

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

excludeKeywords*array<string>

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

message*string

The direct message the rule sends.

enabled*boolean

false while the rule is paused.

Example Request
import { Configuration, AutomationsApi } from "@onepostly/sdk";const automationsApi = new AutomationsApi(  new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY }));const response = await automationsApi.updateAutomation({  id: "aut_4b8e2f6a1c9d4e37a5b02c8f6d1e9a33",  updateAutomationBody: {    "enabled": false  },});console.log(response);
Example Response
{  "id": "aut_4b8e2f6a1c9d4e37a5b02c8f6d1e9a33",  "accountId": "acc_YOUR_INSTAGRAM_ACCOUNT_ID",  "name": "Free guide giveaway",  "kind": "comment_to_dm",  "keywords": [    "guide",    "free"  ],  "excludeKeywords": [    "guidelines"  ],  "message": "Thanks for your interest! Here is your guide.",  "enabled": false}