Mensagens

Enviar lote de mensagens

Changed on

Envia o mesmo template para até 1.000 destinatários em uma chamada. Para mais que isso, use Campanhas.

O lote é tudo ou nada: um telefone inválido ou saldo insuficiente recusa o lote inteiro com 422 UNPROCESSABLE_ENTITY.

Com Idempotency-Key, repetir a chamada devolve o lote original sem reenviar. Acompanhe o lote em GET /v1/messages?batchId=.

Permissão: MESSAGES_SEND.

post/v1/messages/batch

Request

Headers

Idempotency-Keystring

Chave de idempotência, de 1 a 255 caracteres, sem caracteres de controle (fora disso: 400 INVALID_IDEMPOTENCY_KEY). Derive de um evento do seu sistema (id do pedido, id da tentativa) e reuse a mesma chave nas retentativas.

Request body

templateNamestring required

Nome do template aprovado, igual para todo o lote.

Example request

{
  "messages": [
    {
      "receiver": "+5511999999999"
    }
  ]
}

Response

Lote aceito

batchIdstring required

Use em GET /v1/messages?batchId= para acompanhar o lote.

templateNamestring required
totalinteger required

Destinatários recebidos.

acceptedinteger required

Mensagens aceitas para envio.

totalCostnumber required

Custo total em reais.

Example response

{
  "batchId": "ara_msg_b7C1d2E",
  "templateName": "pedido_confirmado",
  "total": 2,
  "accepted": 2,
  "totalCost": 0.136,
  "messages": [
    {
      "id": "ara_msg_a1B2c3D",
      "receiver": "whatsapp:+5511999999999",
      "status": "PENDING",
      "cost": 0.068
    },
    {
      "id": "ara_msg_e4F5g6H",
      "receiver": "whatsapp:+5511888888888",
      "status": "PENDING",
      "cost": 0.068
    }
  ]
}

Changes

    • info

      api tag Mensagens added

    • info

      api tag messages removed

    • info

      added the non-success response with the status

    • info

      removed the non-success response with the status

    • breaking

      the request property's minItems was increased to 1

    • breaking

      the response property / became nullable for the status

    • breaking

      the response property / became nullable for the status

    • breaking

      the response property / became nullable for the status

    • breaking

      the response property became optional for the status

    • breaking

      the response's property type changed from object to string for status

    • breaking

      the // response's property format changed from float to no format for status

    • breaking

      the response's property format changed from float to no format for status

    • breaking

      removed the required property / from the response with the status

    • breaking

      removed the required property / from the response with the status

    • warning

      removed the optional property / from the response with the status

    • info

      added the new optional header request parameter Idempotency-Key

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status