Ir al contenido

Referencia: Mensajes ​

Generada desde el contrato OpenAPI

Esta referencia se genera directamente del contrato de la API, por lo que sus descripciones están en inglés. Puedes descargarlo en openapi.json. Las guías explican cómo usar estos endpoints.

Messages​


List messages​

GET
/messages

Inbound and outbound messages, newest first, with cursor pagination (follow meta.next_cursor).

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Parámetros​

Query Parameters

instance

Only messages of this instance.

Tipo
string
Longitud máx.
40
direction
Tipo
string
Valores válidos
"outbound""inbound"
type
Tipo
string
Valores válidos
"text""image""document""audio""video"
status

One status or a comma-separated list of statuses.

Tipo
string
Longitud máx.
120
limit

Page size (default 25).

Tipo
integer
Mínimo
1
Máximo
100
cursor

Opaque cursor from a previous page (meta.next_cursor).

Tipo
string
Longitud máx.
512

Respuestas​

A page of messages.

application/json
JSON
{
  
"data": [
  
  
{
  
  
  
"id": "string",
  
  
  
"instance_id": "string",
  
  
  
"direction": "string",
  
  
  
"type": "string",
  
  
  
"status": "string",
  
  
  
"to": "string",
  
  
  
"from": "string",
  
  
  
"group_id": "string",
  
  
  
"text": "string",
  
  
  
"caption": "string",
  
  
  
"media": {
  
  
  
  
"mime_type": "string",
  
  
  
  
"size": 0,
  
  
  
  
"filename": "string",
  
  
  
  
"available": true
  
  
  
},
  
  
  
"error": {
  
  
  
  
"code": "string",
  
  
  
  
"message": "string"
  
  
  
},
  
  
  
"created_at": "string",
  
  
  
"queued_at": "string",
  
  
  
"sent_at": "string",
  
  
  
"delivered_at": "string",
  
  
  
"read_at": "string",
  
  
  
"failed_at": "string",
  
  
  
"received_at": "string"
  
  
}
  
],
  
"links": {
  
  
"additionalProperties": "string"
  
},
  
"meta": {
  
  
"per_page": 0,
  
  
"next_cursor": "string",
  
  
"prev_cursor": "string",
  
  
"additionalProperties": "string"
  
}
}

Ejemplos​


Send a message​

POST
/messages

Queues a text or media message (image, document, audio, video) to a phone number or a group. Sending is asynchronous - the response is 202 with status queued; follow the status through GET /messages/{message} or the message.* webhooks. Use JSON for text and multipart/form-data for media. Send an Idempotency-Key to make retries safe.

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Parámetros​

Header Parameters

Idempotency-Key

1 to 255 printable ASCII characters, no spaces. Keys are remembered for 24 hours. The same key with the same request returns the original message (200 and Idempotent-Replayed true). The same key with a different request is rejected with IDEMPOTENCY_KEY_REUSED.

Tipo
string
Longitud máx.
255

Cuerpo de la petición​

JSON
{
  
"instance": "string",
  
"to": "string",
  
"type": "string",
  
"text": "string"
}

Respuestas​

Replay of an earlier request with the same Idempotency-Key. Nothing new was queued.

application/json
JSON
{
  
"data": {
  
  
"id": "string",
  
  
"instance_id": "string",
  
  
"direction": "string",
  
  
"type": "string",
  
  
"status": "string",
  
  
"to": "string",
  
  
"from": "string",
  
  
"group_id": "string",
  
  
"text": "string",
  
  
"caption": "string",
  
  
"media": {
  
  
  
"mime_type": "string",
  
  
  
"size": 0,
  
  
  
"filename": "string",
  
  
  
"available": true
  
  
},
  
  
"error": {
  
  
  
"code": "string",
  
  
  
"message": "string"
  
  
},
  
  
"created_at": "string",
  
  
"queued_at": "string",
  
  
"sent_at": "string",
  
  
"delivered_at": "string",
  
  
"read_at": "string",
  
  
"failed_at": "string",
  
  
"received_at": "string"
  
}
}

Ejemplos​


Get a message​

GET
/messages/{message}

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Respuestas​

The message.

application/json
JSON
{
  
"data": {
  
  
"id": "string",
  
  
"instance_id": "string",
  
  
"direction": "string",
  
  
"type": "string",
  
  
"status": "string",
  
  
"to": "string",
  
  
"from": "string",
  
  
"group_id": "string",
  
  
"text": "string",
  
  
"caption": "string",
  
  
"media": {
  
  
  
"mime_type": "string",
  
  
  
"size": 0,
  
  
  
"filename": "string",
  
  
  
"available": true
  
  
},
  
  
"error": {
  
  
  
"code": "string",
  
  
  
"message": "string"
  
  
},
  
  
"created_at": "string",
  
  
"queued_at": "string",
  
  
"sent_at": "string",
  
  
"delivered_at": "string",
  
  
"read_at": "string",
  
  
"failed_at": "string",
  
  
"received_at": "string"
  
}
}

Ejemplos​


Download the media of a message​

GET
/messages/{message}/media

Streams the stored file as an attachment. Only messages whose media.available is true have a file.

Autorizaciones​

bearerAuth

An API key created in the dashboard (Authorization: Bearer ). The scopes listed on each operation must be granted to the key: instances:read, instances:write, messages:read, messages:send, webhooks:read, webhooks:write.

Tipo
HTTP (bearer)

Respuestas​

The file. Content-Type is the stored MIME type.

application/octet-stream

Ejemplos​