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

Sync triggers

Update a sync trigger

POST
/v1/workspaces/{workspace_id}/bases/{base_id}/triggers/{trigger_id}

Replace a trigger of a sync with the whole trigger you send; the trigger keeps its id. Send validate_only: true to run every check without storing.

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 the resources belong to

base_id*string

The sync (a sync is called a base in these paths)

Formatuuid
trigger_id*string

The trigger to update

Query Parameters

region*string

Data region of the sync

Value in"besg""usnv"

Request Body

The whole trigger after the change. The example's host hooks.example.com is a placeholder: replace it with your own HTTPS endpoint; it must resolve publicly. hooks.example.com is a placeholder: replace it with your own host, which the API checks before saving (the example as written is refused).

application/json
  1. body

A trigger of the sync: when a change of the chosen table passes the filters, the action runs

name*string

The name of the trigger

trigger_type*string

webhook calls a URL, db_query runs SQL on a database connection, queue adds a message to a queue

Value in"webhook""db_query""queue"
table*string

The table whose changes fire the trigger, by its name in the column_names_from_app app (its id is accepted)

column_names_from_app*string

The app whose column names the trigger uses: its app type as shown in Stacksync, or its app_id when both apps have the same type

operations*array<string>

The changes that fire the trigger, each once: created, updated, deleted

source*array<string>

The app or apps whose changes fire the trigger, by app type (or app_id when both apps have the same type); the sync must read changes from that app's table

Items1 <= items <= 2
columns_to_ignore*array<string>

Columns of the table left out of the record data the action receives (case sensitive, must exist in the table)

filters*

Conditions combined with and or or; a group may hold other groups. An empty and group matches every change

action*||

What runs: a cURL command (webhook), a query (db_query) or a queue message (queue)

is_paused?boolean

True stores the trigger paused; false (the default) runs it

Defaultfalse
validate_only?boolean

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

Defaultfalse

Response Body

The trigger updated

application/json
  1. response

What was done

msg*string

What was done

Update a sync trigger
curl -X POST 'https://api.stacksync.com/v1/workspaces/0/bases/497f6eca-6276-4993-bfeb-53cbbbba6f08/triggers/string?region=besg' \  -H 'Content-Type: application/json' \  -d '{  "name": "Notify on new customer accounts",  "trigger_type": "webhook",  "table": "Account",  "column_names_from_app": "salesforce",  "operations": [    "created"  ],  "source": [    "salesforce"  ],  "columns_to_ignore": [    "Website"  ],  "filters": {    "type": "group",    "operator": "and",    "conditions": [      {        "type": "condition",        "column": "Type",        "operator": "eq",        "value": "Customer"      },      {        "type": "group",        "operator": "or",        "conditions": [          {            "type": "condition",            "column": "Rating",            "operator": "eq",            "value": "Hot"          },          {            "type": "condition",            "column": "Website",            "operator": "has_ch",            "value": ""          }        ]      }    ]  },  "action": "curl -X POST https://hooks.example.com/accounts -H '\''Content-Type: application/json'\'' -d '\''{\"record\": <<data>>, \"changes\": <<changes>>}'\''"}'
{  "msg": "Trigger updated successfully"}