REST API

Automations

Comment to DM, keyword replies and the other automations: create one from a template, read it, change it, turn it on and see its runs.

An automation is one JSON document: triggers (a comment, a DM, a mention, a story reply) and the steps that follow. The dashboard wizard, the canvas and these endpoints all edit the same document, so a flow made here opens in the dashboard and the other way round.

Most flows start from a template. A new flow is a draft until you enable it, and nothing goes out to anyone before that. If the account is not subscribed to the channel's webhooks yet, the response also carries warning: reconnect the account, or the flow will not hear any events.

Templates and what each channel can do

GET/v1/automations/templates

Every template: its id, channels, parameters (JSON Schema) and the reviewed feature it needs, if any.

GET/v1/automations/capabilities

Per channel: which triggers and steps a flow may use there.

Create

POST/v1/automations/quick/{template}

Create a flow from a template and its parameters. The usual way.

NameTypeDescription
templateRequiredpathA template id from GET /v1/automations/templates, e.g. comment_to_dm, comment_public_reply, keyword_dm, default_reply.
accountIdRequiredstringThe connected account the flow runs on.
paramsRequiredobjectThe template's parameters. Their schema is in the template's params.
enabledbooleantrue to turn it on right away. Defaults to false (a draft).
namestringDefaults to the template's title.
curl -X POST https://api.uplika.com/v1/automations/quick/comment_to_dm \
  -H "Authorization: Bearer $UPLIKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "acc_7f3c",
    "params": {
      "post": "any",
      "keywords": ["link"],
      "message": "Thanks for the comment. Tap below and I will send the link.",
      "buttonTitle": "Send me the link",
      "deliver": { "text": "Here it is.", "links": [{ "title": "Open", "url": "https://example.com" }] }
    }
  }'

POST/v1/automations

Create a flow from a full document.

NameTypeDescription
accountIdRequiredstringThe connected account the flow runs on.
docRequiredobjectThe flow document: triggers and nodes. POST /v1/automations/validate checks it first.
namestringDefaults to Untitled automation.
enabledbooleanDefaults to false.
postIdstringTies the flow to one of your posts.

POST/v1/automations/validate

Check a document without saving it. Answers the list of problems, empty when it is fine.

List and read

GET/v1/automations

Every flow in the workspace, newest first.

GET/v1/automations/{id}

One flow with its document, version, run counts and the channel's capabilities.

Change, turn on and off

PUT/v1/automations/{id}

Replace the document. Send the version you read; a newer save answers 409 version_conflict.

NameTypeDescription
versionRequirednumberThe version you read. A newer save answers 409 version_conflict with the current version.
docobjectThe new document. Or send template instead.
templateobject{ id, params }: rebuild the document from a template, as the dashboard wizard does.
namestringA new name.

PATCH/v1/automations/{id}

Rename, or turn on and off with enabled.

POST/v1/automations/{id}/enable

Turn it on. From this moment messages go to real people.

POST/v1/automations/{id}/disable

Turn it off. Runs that are waiting do not continue.

POST/v1/automations/{id}/duplicate

Copy it as a new draft, with the same document and template parameters.

DELETE/v1/automations/{id}

Delete the flow, its runs and its versions.

Runs and versions

A run that stopped says why in error, or in its log: window_closed when the 24-hour messaging window was closed, private_reply_expired when the comment was older than 7 days, and a sentence with an address when another app holds the conversation. GET /v1/help?code=<reason> returns what to do.

GET/v1/automations/{id}/runs

What happened each time it fired: status, the reason it stopped, and a step log.

NameTypeDescription
limitquery1-200, defaults to 50.
beforequeryA run id from the previous page.

GET/v1/automations/{id}/versions

Saved versions of the document, newest first.

GET/v1/automations/{id}/versions/{version}

One saved version of the document.