Signals let workflows communicate at runtime. A workflow can pause and wait for
a signal, and another workflow (or your application code) can send that signal
to wake it up with data attached.
This is useful any time a workflow needs to wait for something that isn’t on a
timer: a human approval, a webhook callback, a payment confirmation, or a
coordination message from another workflow.
Basic Usage
Waiting for a Signal
Use step.waitForSignal() inside a workflow to pause until a matching signal
arrives:
Sending a Signal
Send a signal from another workflow using step.sendSignal():
Or send a signal from your application code using the client:
Signals are not buffered. If you send a signal before any workflow is waiting
for it, the signal is lost.
Signal Names
Signal names are arbitrary strings scoped to the backend namespace. Use
descriptive, unique names, often including an entity ID, to avoid collisions:
Step Names
Like other step types, signal steps need unique names within a workflow. If you
don’t provide one, OpenWorkflow uses the signal name as the step name.
Timeout
step.waitForSignal accepts an optional timeout. If the signal doesn’t
arrive before the timeout, the step resolves with null instead of blocking
forever.
timeout accepts a duration string, a
number of milliseconds, or a Date.
If no timeout is specified, the wait defaults to 1 year.
Schema Validation
Validate signal payloads at receive time using any
Standard Schema compatible validator:
If the signal data doesn’t match the schema, the step fails permanently (no
retries) to surface the contract violation immediately.
Idempotency
When sending signals from the client, you can provide an idempotency key to
safely retry without delivering the signal twice:
If a signal with the same idempotency key has already been sent and delivered to
at least one waiter, the call returns the original result without re-delivering.
Fan-Out: One Signal, Many Waiters
A single sendSignal call delivers to every workflow currently waiting on that
signal name:
Sending Signals from Workflows
Use step.sendSignal() inside a workflow to send signals durably. The send is
recorded as a step attempt, so it won’t be repeated on replay:
Common Patterns
Human-in-the-Loop Approval
Webhook Callback
Workflow-to-Workflow Coordination