Skip to main content
context.notify() notifies workflows that are waiting for a specific event, passing along an optional payload. It is typically used in combination with context.waitForEvent.

Arguments

string
A unique identifier for the step.
string
The identifier of the event to notify. Must match the eventId used in context.waitForEvent.
any
Data to deliver to the waiting workflow(s). This value will be returned in eventData from the corresponding waitForEvent call.
string
The workflow run ID to notify. When provided, enables lookback functionality - the notification will be stored and delivered even if notify is called before waitForEvent.This solves race conditions where notifications might be sent before a workflow reaches its wait step.

Response

context.notify() returns an object containing the notified event and the list of workflows that were notified.
string
The event ID that was notified.
any
The event data sent with the notification.
NotifyResponse[]
A list of NotifyResponse objects, one for each workflow that was waiting on the event. An empty list means no workflow was waiting.

Usage

Basic Notification

Notification with Lookback

To prevent race conditions, you can provide a workflowRunId. This enables lookback - the notification will be stored and delivered even if sent before the target workflow reaches waitForEvent: