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_idstringrequerido
Cuenta Octuvia del número (
acc_…).Ej: acc_01J8Z3K4M5N6P7Q8R9S0T1U2V3tostringrequerido
Destinatario E.164.Ej:
+51987654321typestringrequerido
text | template | image | video | audio | document | sticker | location | contacts | interactive.Ej: templatetextobjectopcional
Si
type=text.bodystringrequerido
Texto. Máx. 4096.
preview_urlbooleanopcional
Preview de links. Default
true.templateobjectopcional
Si
type=template (fuera de ventana 24 h).idstringopcional
Preferido.
tpl_….Ej: tpl_01J8Z3K4M5N6P7Q8R9S0T1U2V3namestringopcional
Alternativa a
id (con language).Ej: pedido_enviadolanguagestringopcional
Obligatorio si no mandas
id.Ej: esbody_parametersarrayopcional
Valores de
{{1}}, {{2}}… del BODY.header_parametersarrayopcional
Parámetros del encabezado (texto o media).
imageobjectopcional
Si
type=image: { url } o { media_id } (+ caption?).reply_tostringopcional
msg_… a citar (opcional).metadataobjectopcional
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
| Campo | Uso |
|---|---|
id | msg_… aceptado. |
conversation_id | conv_… encontrado o creado. Úsalo en Conversaciones. |
status | queued. Confirma con webhooks message.sent / message.failed. |
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"
}