App triggers
Create an app trigger
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
AuthorizationstringheaderrequiredBearer <key>, where <key> is a workspace API key or a user API key. See Authentication.
workspace_id*integerThe workspace. List the ones your key can reach with GET /v1/workspaces.
region*RegionsRegion of the resource: besg (Europe) or usnv (United States), as GET /v1/regions lists them
"besg""usnv"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.
nullapplication/json- body
target*connection_id*Connection IdA connection of the app the workflow step or the genie watches
tables*array<>1 <= items <= 100validate_only?Validate OnlyRun every check of the write and answer 204 without writing: a refused write answers the error the write would
falseCreated
application/json- response
app_trigger_id*App Trigger Idtarget*What runs on each change
connection_id*Connection IdThe connection whose app is watched
tables*array<>One entry per trigger: the table, its record changes, filters
status*AppTriggerStatus"on""paused"region*Regions"besg""usnv"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"}GETGet an app trigger
The workflow step or genie it runs, the connection it watches, its tables with their record changes and filters, and whether it is on.
PATCHUpdate an app trigger
Replace its tables (each with its record changes and filters), or switch it on or pause it. The target and the connection stay. Only the fields sent change.