Skip to main content
Create a new workflow that executes custom JavaScript/TypeScript code in response to events. Workflows run in Cloudflare Workers with access to room data, stores, and file storage.

Endpoint

Authentication

Bearer token required.

Request Body

name
string
required
A descriptive name for the workflow.
code
string
required
JavaScript or TypeScript source code to execute when triggered.
events
string[]
required
List of events that trigger this workflow. At least one event is required. Same event types as webhooks.
roomId
string
Scope the workflow to a specific room. If omitted, the workflow triggers for events in all rooms.

Available Events

Worker Bindings

Your workflow code has access to these bindings:

Response

workflow
WorkflowRegistration
The created workflow. See WorkflowRegistration.

Example

Response (201)