Skip to main content
POST
Create a WebSocket trigger

Authorizations

hookie_session
string
cookie
required

The console's sealed session cookie, set by WorkOS AuthKit. Mutating requests also require the X-Requested-With CSRF header.

Headers

Idempotency-Key
string

Makes a POST safe to retry for 24 hours: the same key, credential, path and body returns the stored response (Idempotent-Replayed: true) instead of running again. 422 if the key was used for a different request; 409 while the first is in flight.

Required string length: 1 - 255

Path Parameters

project_id
string
required

Body

application/json
name
string
required
Required string length: 1 - 80
url
string
required

Must start with ws:// or wss://. Encrypted at rest with the rest of the connection config.

headers
object

Connection headers. Encrypted; never returned.

subprotocols
string[]
connect_message
string | null

Sent once on connect (e.g. a subscribe frame).

conditions
object[]

Frame filter; an empty array matches every frame. Validated on save (#165) and stored in the full {path, op, value} form.

mappings
object[] | null

Optional [{path,key}] field mappings, validated as a rule's are and applied to every matching frame the way a rule's are (#228): each picks a path out of the frame into a key of the event, which is what is filed into dataset or handed to the project's rules, and what default keeps when no rule matches (#284). The submission keeps the frame as it arrived. An empty array or null keeps the frame unchanged (identity).

dataset
string | null

Optional dataset every matching frame is stored in, as one record (after mappings). null or absent routes each frame through the project's mapping rules, and a frame none of them matches is stored whole, as one record, in the dataset default (#284) rather than kept as a submission with no record. Validated as a dataset name.

Response

Created, enabled, and the WsListener Durable Object is armed immediately. NOTE: this handler returns 200, not 201.

id
string
required
ws_trigger
object

The created ws trigger, as GET by id returns it (#201).