DoneTalk Desenvolvedores Entrar

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

CampoDetalhes
slugO identificador da empresa no DoneTalk (o mesmo da chave).

Corpo do pedido

CampoTipoObrigatórioDetalhes
phonestringsim
contactNamestringnãoaté 200 caracteres
channelIdstring (uuid)não
templateIdstring (uuid)sim
bodylista de stringnãoaté 20; default []
headerlista de stringnãoaté 5; default []
buttonsobjectnãodefault {}
handlingum de number, teamnãodefault "number"
assigneeEmailstring (email)nãoaté 320 caracteres
idempotencyKeystringsimaté 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

  • 401 unauthorized
  • 403 insufficient_scope
  • 409 template_not_approved
  • 422 validation_failed
  • 429 rate_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

CampoDetalhes
slugO identificador da empresa no DoneTalk (o mesmo da chave).
idO 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

  • 401 unauthorized
  • 403 insufficient_scope
  • 422 validation_failed
  • 429 rate_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

CampoDetalhes
slugO identificador da empresa no DoneTalk (o mesmo da chave).

Parâmetros de consulta

CampoTipoObrigatórioDetalhes
phonestringsim
sincestring (date-time)sim
channelIdstring (uuid)não
directionum de inbound, outboundnão
limitintegernãoaté 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

  • 401 unauthorized
  • 403 insufficient_scope
  • 422 validation_failed
  • 429 rate_limited

Esta página em Markdown