cURL
curl -X POST "https://api.myworklayer.com/v1/rooms/cmhx3q7v20004l808sd5k2r1m/workers/6f1c2a9e-4b7d-4e2a-9c51-3d8e0b7a1f24/messages" \
-H "Authorization: Bearer $WORKLAYER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Also add a note that the parcel needs a signature.",
"delivery": "queue"
}'const response = await fetch('https://api.myworklayer.com/v1/rooms/cmhx3q7v20004l808sd5k2r1m/workers/6f1c2a9e-4b7d-4e2a-9c51-3d8e0b7a1f24/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.WORKLAYER_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"text": "Also add a note that the parcel needs a signature.",
"delivery": "queue"
}),
});
const data = await response.json();
console.log(data);{
"messageId": "3c9d1e7a-52b4-4f0e-8a6d-0e2b7f4c9a15"
}{
"statusCode": 400,
"message": "Supply nonblank text within the composer limit and a valid delivery.",
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 402,
"message": "Worker turn could not start."
}{
"statusCode": 403,
"message": "Environment owner cannot access this Worker.",
"error": "Forbidden"
}{
"statusCode": 404,
"message": "Worker not found.",
"error": "Not Found"
}{
"statusCode": 429,
"message": "ThrottlerException: Too Many Requests"
}{
"statusCode": 503,
"message": "Worker turn could not start."
}Workers
Send a message to a Worker
Sends a queued or mid-flight steering message to a Worker. The Worker executes with the factory owner’s permissions.
POST
/
v1
/
rooms
/
{roomId}
/
workers
/
{workerId}
/
messages
cURL
curl -X POST "https://api.myworklayer.com/v1/rooms/cmhx3q7v20004l808sd5k2r1m/workers/6f1c2a9e-4b7d-4e2a-9c51-3d8e0b7a1f24/messages" \
-H "Authorization: Bearer $WORKLAYER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Also add a note that the parcel needs a signature.",
"delivery": "queue"
}'const response = await fetch('https://api.myworklayer.com/v1/rooms/cmhx3q7v20004l808sd5k2r1m/workers/6f1c2a9e-4b7d-4e2a-9c51-3d8e0b7a1f24/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.WORKLAYER_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"text": "Also add a note that the parcel needs a signature.",
"delivery": "queue"
}),
});
const data = await response.json();
console.log(data);{
"messageId": "3c9d1e7a-52b4-4f0e-8a6d-0e2b7f4c9a15"
}{
"statusCode": 400,
"message": "Supply nonblank text within the composer limit and a valid delivery.",
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized"
}{
"statusCode": 402,
"message": "Worker turn could not start."
}{
"statusCode": 403,
"message": "Environment owner cannot access this Worker.",
"error": "Forbidden"
}{
"statusCode": 404,
"message": "Worker not found.",
"error": "Not Found"
}{
"statusCode": 429,
"message": "ThrottlerException: Too Many Requests"
}{
"statusCode": 503,
"message": "Worker turn could not start."
}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.
Path Parameters
Body
application/json
The message. It must not be blank.
Maximum string length:
16000Response
The message is saved. Read status to know if the Worker started work on it.
Omitted when the Worker started processing the message. execution_unconfirmed: the message was saved, but execution start could not be confirmed—don't resend; inspect the Worker's status or messages. not_started: the message was saved, but execution did not start.
Available options:
execution_unconfirmed, not_started