Skip to content

Triggers

Show API code examples on this page as

Triggers are named queries that run on a repeating schedule and track how their results change over time. Instead of returning data directly, they accumulate deltas — rows that were added or removed since the last time you checked.

These are ideal for driving workflows: poll on a schedule from your application and react when something new appears or disappears.


Describe what you want to monitor in plain English — Triggerware will figure out the right query and schedule.

POST /triggers
curl -X POST https://api.triggerware.com/triggers \
-H "Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{...}'

The response confirms the trigger name, the SQL that was generated, and the schedule in seconds:

{
"name": "new_signups",
"query": "select id, email, created_at from users order by created_at desc limit 100",
"schedule": 300,
"status": "enabled"
}

The schedule is always expressed as a number of seconds — 300 means every 5 minutes, 86400 means once a day.


Once a trigger exists, call the “poll” endpoint from your application to consume any accumulated deltas. Each successful response clears the queue.

POST /triggers/{name}/poll
curl -X POST https://api.triggerware.com/triggers/<name>/poll \
-H "Api-Key: YOUR_API_KEY"

If there are changes, the response contains two lists — rows that were added and rows that were deleted:

{
"added": [
["u_1234", "alice@example.com", "2026-01-15T09:00:00Z"],
["u_1235", "bob@example.com", "2026-01-15T09:02:00Z"]
],
"deleted": []
}

If nothing has changed since the last poll, you get an empty response. Your application should treat this as “nothing to do.”


GET /triggers
curl https://api.triggerware.com/triggers \
-H "Api-Key: YOUR_API_KEY"

Returns all your triggers:

[
{
"name": "new_signups",
"query": "select id, email, created_at from users order by created_at desc limit 100",
"schedule": 300,
"status": "enabled",
"delivery": null,
"created_at": "2026-01-15T08:00:00Z"
}
]

Edit a trigger’s query, schedule, delivery, or enabled status. Setting “status” to “disabled” pauses the trigger without deleting it:

PATCH /triggers/{name}
curl -X PATCH https://api.triggerware.com/triggers/<name> \
-H "Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{...}'

DELETE /triggers/{name}
curl -X DELETE https://api.triggerware.com/triggers/<name> \
-H "Api-Key: YOUR_API_KEY"

Deleting a trigger stops it immediately and discards any unconsumed deltas.