Triggers in depth
A trigger decides when a workflow starts. The five kinds each have their own node page; this page covers what they share: what happens when a trigger fires while a run is going, filters, secrets, and how to find out why a run didn't start.
The five triggers
| Trigger | Starts a run when |
|---|---|
| Client message | A client, or any client, sends a message of a type. It can also wait until a filter has held for a while, like "temperature above 30 for 10 minutes". |
| Client online or offline | A client has stayed online, or offline, for a time you set (60 seconds by default). |
| Schedule | A cron timetable comes round, in UTC. |
| Webhook received | Another service POSTs to the workflow's own URL. |
| Run by hand | Someone starts it from the console or the API, or another workflow's Run workflow step does. |
A workflow can have several triggers. Each one starts its own runs.
When it fires while a run is going
Under Advanced, each trigger says what happens if it fires again while an earlier run it started is still going:
| Choice | What happens |
|---|---|
| Queue it (default) | The new event waits. When the running one ends, the oldest waiting event starts the next run. Events wait at most 24 hours. |
| Run both | Starts another run alongside. |
| Cancel the running one | Starts a new run and cancels the one going. If the new run can't start (out of credits, too many runs), the old one is left alone. |
| Skip it | The new event is dropped. |
"A run going" means one with the same correlation key. By default that is the trigger's own source: the client and message type, the client and its state, or the webhook path. Set a correlation key, like $trigger.payload.zone, and runs are grouped by that value instead, so zone A and zone B queue separately.
Filters and holds
Client message and webhook triggers can have a filter, a condition on the incoming data, like temp greater than 30. An event that doesn't match starts nothing and costs nothing. A filter that can't be worked out, say a field that isn't there, counts as no match.
A Client message trigger with a filter can also hold: it fires only once the filter has kept matching for the time you set (up to 24 hours), then stays quiet until a message stops matching. That turns "too hot" into "too hot for 10 minutes", without a run for every reading.
Webhooks
- The URL is
https://api.dev.wbskt.com/api/callbacks/webhook/{workspace}/{path}, and onlyPOSTstarts a run. The body, up to 128 KB, becomes the run's trigger data. - Give the trigger a secret and callers must send it in the
X-Wbskt-Secretheader. - The answer is always
202, whether it started a run, didn't match, or had the wrong secret, so the URL can't be probed. Check the trigger's recent events (below) to see what happened. - Send an
Idempotency-Keyheader and a retry with the same key within 24 hours starts nothing new. - A path takes 600 requests a minute. One address can make 1,200 callback requests a minute in all.
Schedules
Schedules run in UTC. If WBSKT was down when a schedule came due, it fires once when it is back, for the latest time it missed, then carries on as usual. An every-minute schedule that missed two hours starts one run, not 120.
Why didn't it start?
Each trigger keeps what it did with its last 20 events: the time, the message type, the outcome, and the run it started. It can take a couple of seconds for the newest to show.
| Outcome | Means |
|---|---|
| Started run | It started a run, linked. |
| Queued | It waits behind a run with the same key. |
| Dropped | Skipped, because a run with the same key was going. |
| Refused | Not allowed to start: out of credits, the workspace's cap, or too many runs at once. |
| Filtered | The filter didn't match. |
| Secret mismatch | A webhook arrived without the right secret. |
| Idempotent | The same event arrived twice; the second did nothing. |
| Held | A hold trigger saw a matching message and is counting. |
An event that matched no trigger at all, like a message type nobody listens for, has no workflow to show it under and isn't kept. See also My rule didn't run.
What happens when…
- The same message is delivered twice
- It starts at most one run per trigger.
- Two workflows listen for the same thing
- Each starts its own run, independently, with its own concurrency choice.
- I turn a workflow off while events are queued
- The queued events are dropped. Turning it on again doesn't bring them back.
- A board goes offline for 30 seconds with a 60-second offline trigger
- Nothing starts: it has to stay offline for the whole 60 seconds. A board installing firmware counts as updating, not offline, for up to 5 minutes.
- The account is out of credits
- New runs are refused and show as Refused. Events aren't queued for later; they are dropped. The refusal is recorded in the audit log, at most once a minute per workflow.
Rules and API
Trigger settings
| Kind | Settings |
|---|---|
trigger:client | clientRef, type (* for any), correlationKey, concurrencyPolicy, filter, holdSeconds (needs a filter, at most 86,400). |
trigger:clientPresence | clientRef, state (Online or Offline), forSeconds (default 60, at most 86,400), correlationKey, concurrencyPolicy. |
trigger:schedule | cron, correlationKey. |
trigger:webhook | path, correlationKey, concurrencyPolicy, filter, secret. |
trigger:manual | description, inputs ([{ name, label?, default? }], read as $trigger.body.NAME). |
Concurrency policies on the wire: Queue, AllowParallel, CancelExisting, DropIfRunning.
Endpoint
GET /api/v1/workspaces/{workspaceRef}/workflows/{workflowRef}/triggers/{nodeId}/recent (workflows.read) answers recent, the last 20 outcomes, and hold (holding, fired or clear, with sinceAt and dueAt) for a hold trigger.
Validation
TRIGGER_CLIENT_REQUIRED, TRIGGER_MESSAGE_TYPE_REQUIRED, WEBHOOK_PATH_MISSING, INVALID_CLIENT_REF, INVALID_CRON, INVALID_PRESENCE_DURATION, INVALID_HOLD_DURATION, HOLD_REQUIRES_FILTER, MANUAL_INPUT_NAME_INVALID, MANUAL_INPUT_NAME_DUPLICATE, MANUAL_INPUT_NAME_RESERVED, and the warning SUSPICIOUS_CORRELATION_KEY.
Guarantees
- Each trigger's start is keyed by the event, stored uniquely on the run, so a redelivered event can't start a second run.
- The concurrency check is made again under a lock when the run is created, so two events arriving together can't both slip past Skip it or Queue it.
- Cancel the running one moves the old runs to Cancelling in the same transaction that starts the new one, and only if it starts.
- A webhook secret is compared as a SHA-256 hash in fixed time, and never written into the run's data.
- A run refused for credits or the plan's run limit isn't queued: the event is gone. The refusal is reported once a minute per workflow as
WorkflowTriggerRefusedEvent. - Queued events are replayed one per finished run. One whose replay fails is tried again.