curl -X POST "https://api.myworklayer.com/v1/rooms/cmhx3q7v20004l808sd5k2r1m/events" \
-H "Authorization: Bearer $WORKLAYER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1188-shipped" \
-d '{
"type": "order.shipped",
"content": "Order 1188 for ticket 4821 is shipped with UPS.",
"attributes": {
"orderId": "1188",
"carrier": "UPS",
"trackingNumber": "1Z999AA10123456784"
},
"delivery": "queue"
}'const response = await fetch('https://api.myworklayer.com/v1/rooms/cmhx3q7v20004l808sd5k2r1m/events', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.WORKLAYER_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': 'order-1188-shipped',
},
body: JSON.stringify({
"type": "order.shipped",
"content": "Order 1188 for ticket 4821 is shipped with UPS.",
"attributes": {
"orderId": "1188",
"carrier": "UPS",
"trackingNumber": "1Z999AA10123456784"
},
"delivery": "queue"
}),
});
const data = await response.json();
console.log(data);{
"eventId": "b7e4c1d2-8a3f-4f6e-9d20-5c1a7e9b3f08",
"delivery": "queue"
}{
"statusCode": 400,
"message": "Invalid Event body",
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 404,
"message": "Room not found.",
"error": "Not Found"
}{
"statusCode": 409,
"message": "Idempotency key has a different Event body",
"error": "Conflict"
}{
"statusCode": 413,
"message": "Payload Too Large",
"error": "Payload Too Large"
}{
"statusCode": 429,
"message": "ThrottlerException: Too Many Requests"
}{
"statusCode": 503,
"message": "Event storage unavailable",
"error": "Service Unavailable"
}Send an Event
Submits an Event to a Room. This endpoint is the programmatic Event source; Channels (Slack), Signals (Gmail), and scheduled runs are configured in the web app. Returns 202 Accepted once persisted—factory replies arrive asynchronously via Room History and Subscriptions. Set delivery to queue (default), steer, or context. context Events do not wake the factory or emit webhooks. Include an Idempotency-Key header for safe retries. See Events.
curl -X POST "https://api.myworklayer.com/v1/rooms/cmhx3q7v20004l808sd5k2r1m/events" \
-H "Authorization: Bearer $WORKLAYER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1188-shipped" \
-d '{
"type": "order.shipped",
"content": "Order 1188 for ticket 4821 is shipped with UPS.",
"attributes": {
"orderId": "1188",
"carrier": "UPS",
"trackingNumber": "1Z999AA10123456784"
},
"delivery": "queue"
}'const response = await fetch('https://api.myworklayer.com/v1/rooms/cmhx3q7v20004l808sd5k2r1m/events', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.WORKLAYER_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': 'order-1188-shipped',
},
body: JSON.stringify({
"type": "order.shipped",
"content": "Order 1188 for ticket 4821 is shipped with UPS.",
"attributes": {
"orderId": "1188",
"carrier": "UPS",
"trackingNumber": "1Z999AA10123456784"
},
"delivery": "queue"
}),
});
const data = await response.json();
console.log(data);{
"eventId": "b7e4c1d2-8a3f-4f6e-9d20-5c1a7e9b3f08",
"delivery": "queue"
}{
"statusCode": 400,
"message": "Invalid Event body",
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 404,
"message": "Room not found.",
"error": "Not Found"
}{
"statusCode": 409,
"message": "Idempotency key has a different Event body",
"error": "Conflict"
}{
"statusCode": 413,
"message": "Payload Too Large",
"error": "Payload Too Large"
}{
"statusCode": 429,
"message": "ThrottlerException: Too Many Requests"
}{
"statusCode": 503,
"message": "Event storage unavailable",
"error": "Service Unavailable"
}Authorizations
Your factory's Worklayer API key (wrk-...). See Get an API key and Authentication. Requests sent from the playground execute live against your factory.
Headers
Your unique key for this Event. 1 to 191 visible ASCII characters. If you send the same key with the same body to the same Room again, you get the same eventId. A body without delivery is the same as a body with delivery set to queue. Send one header only.
^[!-~]{1,191}$