Ir al contenido
Octuvia

Enviar mensaje

Texto (ventana 24 h) o plantilla. Usa el account_id del número conectado. La conversación se crea al vuelo.

POSThttps://api.octuvia.com/v1/messages
Body JSON: account_id + to + type + objeto del tipo. También admite multipart (file) para media. Asíncrono: 202 queued. Recomendado Idempotency-Key.

Parámetros del body

Campo
Descripción
account_id
stringrequerido
Cuenta Octuvia del número (acc_…).Ej: acc_01J8Z3K4M5N6P7Q8R9S0T1U2V3
to
stringrequerido
Destinatario E.164.Ej: +51987654321
type
stringrequerido
text | template | image | video | audio | document | sticker | location | contacts | interactive.Ej: template
text
objectopcional
Si type=text.
body
stringrequerido
Texto. Máx. 4096.
preview_url
booleanopcional
Preview de links. Default true.
template
objectopcional
Si type=template (fuera de ventana 24 h).
id
stringopcional
Preferido. tpl_….Ej: tpl_01J8Z3K4M5N6P7Q8R9S0T1U2V3
name
stringopcional
Alternativa a id (con language).Ej: pedido_enviado
language
stringopcional
Obligatorio si no mandas id.Ej: es
body_parameters
arrayopcional
Valores de {{1}}, {{2}}… del BODY.
header_parameters
arrayopcional
Parámetros del encabezado (texto o media).
image
objectopcional
Si type=image: { url } o { media_id } (+ caption?).
reply_to
stringopcional
msg_… a citar (opcional).
metadata
objectopcional
Metadata libre (string→string).

Request

Plantillajson
{
  "account_id": "acc_01J8Z3K4M5N6P7Q8R9S0T1U2V3",
  "to": "+51987654321",
  "type": "template",
  "template": {
    "id": "tpl_01J8Z3K4M5N6P7Q8R9S0T1U2V3",
    "body_parameters": ["Ana", "1042"]
  }
}
Texto (ventana abierta)json
{
  "account_id": "acc_01J8Z3K4M5N6P7Q8R9S0T1U2V3",
  "to": "+51987654321",
  "type": "text",
  "text": { "body": "Hola, tu pedido salió hoy." }
}

Response

CampoUso
idmsg_… aceptado.
conversation_idconv_… encontrado o creado. Úsalo en Conversaciones.
statusqueued. Confirma con webhooks message.sent / message.failed.

Hilo existente

Si ya tienes conv_…, es más simple Responder en hilo (sin account_id ni to).

Language

Credentials

Header

Authorization

Token de la empresa · HTTP directo

Fetch Request
$ # Node 18+ fetch
const response = await fetch("https://api.octuvia.com/v1/messages", {
  method: "POST",
  headers: {
    "Authorization": "Bearer octuvia_live_…",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "account_id": "acc_01J8Z3K4M5N6P7Q8R9S0T1U2V3",
    "to": "+51987654321",
    "type": "template",
    "template": {
      "id": "tpl_01J8Z3K4M5N6P7Q8R9S0T1U2V3",
      "body_parameters": [
        "Ana",
        "1042"
      ]
    }
  })
});

const data = await response.json();
console.log(data);
HTTP directo · funciona con cualquier cliente HTTP
Response

Elige un ejemplo de respuesta:

application/json
202OK
{
  "object": "message",
  "id": "msg_01J8Z3K4M5N6P7Q8R9S0T1U2V3",
  "conversation_id": "conv_01J8Z3K4M5N6P7Q8R9S0T1U2V3",
  "account_id": "acc_01J8Z3K4M5N6P7Q8R9S0T1U2V3",
  "direction": "outbound",
  "type": "template",
  "status": "queued",
  "created_at": "2026-10-28T12:00:00Z"
}