See Stacksync in action with a solution architect. Book a demo ↗
App triggers

App triggers

Create an app trigger

POST
/v1/workspaces/{workspace_id}/app-triggers

Watch tables of a connection and run a workflow's sync trigger step or a genie's Trigger interface on each matching change, from now on (past records are not replayed). The trigger is switched on and saved on the workflow's draft step or the genie's interface; a draft saved meanwhile is refused with 409 and nothing is created. Send an Idempotency-Key to retry safely.

Authorization

Authorizationstringheaderrequired

Bearer <key>, where <key> is a workspace API key or a user API key. See Authentication.

Path Parameters

workspace_id*integer

The workspace. List the ones your key can reach with GET /v1/workspaces.

Query Parameters

region*Regions

Region of the resource: besg (Europe) or usnv (United States), as GET /v1/regions lists them

Value in"besg""usnv"

Header Parameters

Idempotency-Key?|

Makes the create retry-safe for 24 hours: a retry with the same key answers the resource the first call created, with the Idempotent-Replayed: true header, and creates nothing. 1 to 255 visible ASCII characters. The same key with a different request answers 422; while the first call still runs, 409.

Defaultnull

Request Body

application/json
  1. body
target*
connection_id*Connection Id

A connection of the app the workflow step or the genie watches

tables*array<>
Items1 <= items <= 100
validate_only?Validate Only

Run every check of the write and answer 204 without writing: a refused write answers the error the write would

Defaultfalse

Response Body

Created

application/json
  1. response
app_trigger_id*App Trigger Id
target*

What runs on each change

connection_id*Connection Id

The connection whose app is watched

tables*array<>

One entry per trigger: the table, its record changes, filters

status*AppTriggerStatus
Value in"on""paused"
region*Regions
Value in"besg""usnv"
Create an app trigger
curl -X POST 'https://api.stacksync.com/v1/workspaces/0/app-triggers?region=besg' \  -H 'Content-Type: application/json' \  -d '{  "target": {    "type": "workflow",    "id": "<id>"  },  "connection_id": "<connection_id>",  "tables": [    {      "table_name": "<table_name>",      "operations": [        "created"      ]    }  ]}'
{  "app_trigger_id": "<app_trigger_id>",  "target": {    "type": "workflow",    "id": "<id>",    "step_id": "<step_id>",    "interface_id": "<interface_id>"  },  "connection_id": "<connection_id>",  "tables": [    {      "table_name": "<table_name>",      "operations": [        "created"      ],      "filters": {        "type": "group",        "operator": "and"      }    }  ],  "status": "on",  "region": "besg"}