Send a targeted message
Send a targeted message to everyone matching a name, location, or role — no confirmation step.
POST /messages sends a message to everyone matching a filter, right now. There's no confirmation step — the request sends as written.
curl -X POST "https://mcp.onkey.chat/functions/v1/rest-api/messages" \
-H "Authorization: Bearer okm_<your-token-here>" \
-H "Content-Type: application/json" \
-d '{
"body": "Please submit your hours by Friday.",
"filter": { "location": "Glendale" }
}'const res = await fetch("https://mcp.onkey.chat/functions/v1/rest-api/messages", {
method: "POST",
headers: {
Authorization: "Bearer okm_<your-token-here>",
"Content-Type": "application/json",
},
body: JSON.stringify({
body: "Please submit your hours by Friday.",
filter: { location: "Glendale" },
}),
});
const { sent_to, message_id } = await res.json();
console.log(`Sent to ${sent_to} workers`);The filter must set at least one of name, location, or role. If it matches nobody, you still get a 200 with "sent_to": 0 — not an error.
Messages vs. alertsTargeted messages are not rate-limited. Broadcast alerts (
POST /alerts) share a cap across every channel — see Rate limits.
For the full request and response schema, see the API Reference.
Next steps
- List your active mobile users — find the right audience for a message.
- Errors — the error format and every status code.
Updated about 1 hour ago
Did this page help you?

