curl --request POST \
--url https://public-api.workchats.com/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"blocks": [
{
"text": "New lead from Meta Lead Ads",
"type": "header"
},
{
"fields": [
{
"label": "Campaign",
"value": "Meta Lead Ads (Paid)"
}
],
"type": "fields"
}
],
"metadata": {
"lead_id": "lead_mul0oe5wo0dgol",
"source": "leadey"
},
"reply_to_id": null,
"text": "New lead: Sarah Chen (Acme Ltd) from Meta Lead Ads",
"to": {
"id": "chn_c41a2b3c-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"type": "conversation"
},
"unfurl_links": false
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
blocks: [
{text: 'New lead from Meta Lead Ads', type: 'header'},
{fields: [{label: 'Campaign', value: 'Meta Lead Ads (Paid)'}], type: 'fields'}
],
metadata: {lead_id: 'lead_mul0oe5wo0dgol', source: 'leadey'},
reply_to_id: null,
text: 'New lead: Sarah Chen (Acme Ltd) from Meta Lead Ads',
to: {id: 'chn_c41a2b3c-4d5e-4f60-8a7b-9c0d1e2f3a4b', type: 'conversation'},
unfurl_links: false
})
};
fetch('https://public-api.workchats.com/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://public-api.workchats.com/v1/messages"
payload = {
"blocks": [
{
"text": "New lead from Meta Lead Ads",
"type": "header"
},
{
"fields": [
{
"label": "Campaign",
"value": "Meta Lead Ads (Paid)"
}
],
"type": "fields"
}
],
"metadata": {
"lead_id": "lead_mul0oe5wo0dgol",
"source": "leadey"
},
"reply_to_id": None,
"text": "New lead: Sarah Chen (Acme Ltd) from Meta Lead Ads",
"to": {
"id": "chn_c41a2b3c-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"type": "conversation"
},
"unfurl_links": False
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"message": {
"conversation_id": "dm_77a1b2c3-d4e5-4f60-8a7b-9c0d1e2f3a4b",
"created_at": "2026-09-28T11:05:12.482Z",
"id": "dmsg_4e2d1c0b-9a8f-4e7d-8c6b-5a4f3e2d1c0b",
"reply_to_id": null
},
"ok": true
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}Send a message
Sends a message as the bot: a direct message to a person (to.type: user), or a post in a group or channel the bot is a member of (to.type: conversation). People see text; blocks are stored and shown from a later release. Needs messages:write.
Idempotency. Every send needs an Idempotency-Key, unique per message and destination: <event_id>:<destination_id> works when one event goes to several people. Keys are kept for 24 hours. Repeating a key with the same body returns the original 201 and posts nothing; with a different body, 422 idempotency_key_reused. A repeat of a <!channel> send that arrives while the original is still being written answers 429 rate_limited with Retry-After, and the retry returns the original 201. After 24 hours, a repeat to the same destination still posts nothing: it returns the original 201 while the message is unchanged, and 422 idempotency_key_reused once it was edited or deleted through this API. A key is 1 to 255 visible ASCII characters, with no spaces.
Mentions. Write <@usr_…> in text to mention a person (an id from GET /v1/users) and <!channel> to mention everyone in the conversation. People see @Name and @all. Nothing else is read as a mention: any other <…>, <!here> included, is shown as written, and nothing is unescaped. A <@usr_…> needs users:read: without it, any <@usr_…> is 403 missing_scope, whatever the id. With it, a <@usr_…> is valid exactly when GET /v1/users/{id} answers 200. Any other id is 400 invalid_request, whatever the conversation, and nothing is posted; at most 25 mentions a message. A valid person who is not in the conversation, or who has left, is shown by name and not notified. So is a person who has not finished joining the company (GET /v1/users already lists them with is_active: true), or who is deactivated or removed, as when a colleague mentions them. Everyone else mentioned gets a mention notification, and is pushed even when the installation does not notify conversation members.
Mention priority. In a group or channel, the first push in a minute that this App sends a person it mentions by name has mention priority: it reaches them even outside their working hours, in their quiet hours, while they have muted the group or turned group notifications off, as when a colleague mentions them. Further mentions of the same person by this App in that minute, in any conversation, still show as mentions and still reach their notifications, but are pushed under their usual settings. A <!channel> never has mention priority. blocks are not read for mentions. History returns <@usr_…> and <!channel> as they were sent while the person stays visible to the App; a person who was not notifiable when mentioned reads back as @Name.
Who can receive a DM. People with an active or onboarding account. A deactivated or removed person is 409 user_deactivated; a guest, or someone who blocked the App, is 403 cannot_dm_user.
Rate limits. 5 sends a second per installation with bursts of 20, and 1 a second per destination with bursts of 5. A send with <!channel> is also limited to about one a minute per conversation: one per clock minute, counted on each of our servers, so two can land seconds apart across the minute’s turn, and several servers can each allow one. A retry that answers the original, or a send that fails, does not count. Mention priority is limited the same way.
curl --request POST \
--url https://public-api.workchats.com/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"blocks": [
{
"text": "New lead from Meta Lead Ads",
"type": "header"
},
{
"fields": [
{
"label": "Campaign",
"value": "Meta Lead Ads (Paid)"
}
],
"type": "fields"
}
],
"metadata": {
"lead_id": "lead_mul0oe5wo0dgol",
"source": "leadey"
},
"reply_to_id": null,
"text": "New lead: Sarah Chen (Acme Ltd) from Meta Lead Ads",
"to": {
"id": "chn_c41a2b3c-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"type": "conversation"
},
"unfurl_links": false
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
blocks: [
{text: 'New lead from Meta Lead Ads', type: 'header'},
{fields: [{label: 'Campaign', value: 'Meta Lead Ads (Paid)'}], type: 'fields'}
],
metadata: {lead_id: 'lead_mul0oe5wo0dgol', source: 'leadey'},
reply_to_id: null,
text: 'New lead: Sarah Chen (Acme Ltd) from Meta Lead Ads',
to: {id: 'chn_c41a2b3c-4d5e-4f60-8a7b-9c0d1e2f3a4b', type: 'conversation'},
unfurl_links: false
})
};
fetch('https://public-api.workchats.com/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://public-api.workchats.com/v1/messages"
payload = {
"blocks": [
{
"text": "New lead from Meta Lead Ads",
"type": "header"
},
{
"fields": [
{
"label": "Campaign",
"value": "Meta Lead Ads (Paid)"
}
],
"type": "fields"
}
],
"metadata": {
"lead_id": "lead_mul0oe5wo0dgol",
"source": "leadey"
},
"reply_to_id": None,
"text": "New lead: Sarah Chen (Acme Ltd) from Meta Lead Ads",
"to": {
"id": "chn_c41a2b3c-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"type": "conversation"
},
"unfurl_links": False
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"message": {
"conversation_id": "dm_77a1b2c3-d4e5-4f60-8a7b-9c0d1e2f3a4b",
"created_at": "2026-09-28T11:05:12.482Z",
"id": "dmsg_4e2d1c0b-9a8f-4e7d-8c6b-5a4f3e2d1c0b",
"reply_to_id": null
},
"ok": true
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}{
"error": {
"code": "token_revoked",
"message": "The token has been revoked."
},
"ok": false,
"request_id": "F7p0mJcXk3tq2x0AAAAB"
}Authorizations
Headers
Body
The message
What people see, and the push notification's text. Always send it. <@usr_…> mentions a person and <!channel> everyone in the conversation; they are shown as @Name and @all. Any other <…> is shown as written. An id GET /v1/users/{id} would not return is 400 invalid_request.
1 - 4000