Mensagens
Mandar um modelo para um telefone
POST /v1/c/{slug}/messages/template · Escopos: messages:send_template
Na conversa aberta do contato, ou numa nova, atendida como o número atende o que chega. O contato é criado se não existir. idempotencyKey (ou o cabeçalho Idempotency-Key) evita mandar duas vezes.
Parâmetros do endereço
| Campo | Detalhes |
|---|---|
slug | O identificador da empresa no DoneTalk (o mesmo da chave). |
Corpo do pedido
| Campo | Tipo | Obrigatório | Detalhes |
|---|---|---|---|
phone | string | sim | |
contactName | string | não | até 200 caracteres |
channelId | string (uuid) | não | |
templateId | string (uuid) | sim | |
body | lista de string | não | até 20; default [] |
header | lista de string | não | até 5; default [] |
buttons | object | não | default {} |
handling | um de number, team | não | default "number" |
assigneeEmail | string (email) | não | até 320 caracteres |
idempotencyKey | string | sim | até 200 caracteres |
Exemplo de pedido
curl -X POST "https://api.donetalk.com/v1/c/demo/messages/template" \
-H "Authorization: Bearer $DONETALK_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "+5548999990001",
"contactName": "Ana Souza",
"templateId": "01a0cad0-0000-7000-8000-000000000002",
"body": [
"Ana",
"ANA10"
],
"idempotencyKey": "pedido-88213-lembrete"
}'Resposta 201
{
"message": {
"id": "01a3c0de-8b22-7c33-9d44-0e55f6677889",
"status": "queued"
},
"conversation": {
"id": "01a3c0de-7a11-7b22-8c33-9d44e55f6677"
},
"replay": false
}Erros possíveis
401unauthorized403insufficient_scope409template_not_approved422validation_failed429rate_limited
Status de uma mensagem e a resposta
GET /v1/c/{slug}/messages/{id} · Escopos: conversations:read · messages:send_template · messages:send_text
Parâmetros do endereço
| Campo | Detalhes |
|---|---|
slug | O identificador da empresa no DoneTalk (o mesmo da chave). |
id | O id do registro. |
Exemplo de pedido
curl -X GET "https://api.donetalk.com/v1/c/demo/messages/:id" \
-H "Authorization: Bearer $DONETALK_KEY"Resposta 200
{
"message": {
"id": "01a3c0de-8b22-7c33-9d44-0e55f6677889",
"conversationId": "01a3c0de-7a11-7b22-8c33-9d44e55f6677",
"channelId": "01a0cccc-0000-7000-8000-000000000002",
"direction": "outbound",
"from": null,
"type": "template",
"text": "Oi Ana! Seu cupom ANA10 vale até sexta. Quer usar agora?",
"status": "read",
"errorCode": null,
"createdAt": "2026-10-23T13:02:11.000Z",
"sentAt": "2026-10-23T13:02:12.000Z",
"deliveredAt": "2026-10-23T13:02:13.000Z",
"readAt": "2026-10-23T13:05:40.000Z",
"reply": {
"id": "01a0d05a-3ee3-75bd-9db5-dc9856f079c9",
"type": "button",
"text": "Quero o cupom",
"at": "2026-10-23T13:05:52.000Z"
}
}
}Erros possíveis
401unauthorized403insufficient_scope422validation_failed429rate_limited
Mensagens de um telefone
GET /v1/c/{slug}/messages · Escopos: conversations:read
As mensagens de um telefone desde um momento, mais novas primeiro (com ou sem o nono dígito).
Parâmetros do endereço
| Campo | Detalhes |
|---|---|
slug | O identificador da empresa no DoneTalk (o mesmo da chave). |
Parâmetros de consulta
| Campo | Tipo | Obrigatório | Detalhes |
|---|---|---|---|
phone | string | sim | |
since | string (date-time) | sim | |
channelId | string (uuid) | não | |
direction | um de inbound, outbound | não | |
limit | integer | não | até 100; mínimo 1; default 20 |
Exemplo de pedido
curl -X GET "https://api.donetalk.com/v1/c/demo/messages" \
-H "Authorization: Bearer $DONETALK_KEY"Resposta 200
{
"messages": [
{
"id": "01a3c0de-8b22-7c33-9d44-0e55f6677889",
"conversationId": "01a3c0de-7a11-7b22-8c33-9d44e55f6677",
"channelId": "01a0cccc-0000-7000-8000-000000000002",
"direction": "outbound",
"from": null,
"type": "template",
"text": "Oi Ana! Seu cupom ANA10 vale até sexta. Quer usar agora?",
"status": "read",
"errorCode": null,
"createdAt": "2026-10-23T13:02:11.000Z",
"sentAt": "2026-10-23T13:02:12.000Z",
"deliveredAt": "2026-10-23T13:02:13.000Z",
"readAt": "2026-10-23T13:05:40.000Z"
}
]
}Erros possíveis
401unauthorized403insufficient_scope422validation_failed429rate_limited