Skip to main content
Once you’ve defined a workflow, your app reaches it through the corsair.workflows namespace. It’s available on every client that has Hub configured, and it’s tenant-scoped like the rest of the SDK.

Run a workflow

Call run() with the workflow id:
run() accepts: It resolves to { status, runId? }, where status is 'ok' when the run was accepted, and runId identifies it.
Pass an idempotencyKey whenever a trigger might fire more than once (a retried request, an at-least-once queue). Two run() calls with the same key produce one run, not two.

Scope to a tenant

In a multi-tenant app, resolve the tenant first. The run executes against that tenant’s connected accounts:
In a single-tenant app, corsair.workflows.run(...) runs against the default tenant.

List workflows

Each entry is a WorkflowSummary, enough to render a list, show a status, and pick an id to run().

Trigger types

Manual run() is one of three ways a workflow starts. The other two are configured in Hub and need no call from you:

Manual

Your app calls corsair.workflows.run(id, { payload }). The payload is yours to shape.

Webhook

An incoming trigger fires the workflow; the webhook body arrives as its payload.

Schedule

A cron or cadence configured in Hub runs the workflow on a timer; payload is empty.
However a run starts, it executes the same way. See Execution & steps.