Mensajes
Envíe mensajes al hub del socio para los usuarios finales.
Enviar un mensaje
POST /api/v1/messages
Crea un mensaje de hub independiente (no una conversación de soporte).
Encabezados
Authorization: Bearer <api_key>
Content-Type: application/json
Parámetros del cuerpo
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
phone | string | yes | Destino E.164 |
body | string | * | Cuerpo de texto / leyenda (requerido para text) |
content_type | string | no | Valor predeterminado: text. Consulte los tipos de medios |
template_code | string | no | Se renderiza con vars |
vars | object | no | Variables de la plantilla |
priority | string | no | otp · notification · chat · … |
idempotency_key | string | no | Deduplicar los reintentos |
media_url | string | * | URL de un archivo remoto para los tipos de medios |
media_base64 | string | * | Archivo base64 en lugar de la URL |
media_filename | string | no | Nombre para mostrar |
media_mimetype | string | no | Tipo MIME |
link_url / url | string | * | Para content_type=link |
link_label / cta | string | no | Etiqueta del botón |
link_title | string | no | Título de la tarjeta |
link_description | string | no | Descripción de la tarjeta |
link_image_url | string | no | Imagen de la tarjeta |
html | string | * | Para content_type=html |
subject | string | no | Título de la newsletter (html) |
preview | string | no | Avance en texto sin formato (html) |
Ejemplo de texto
curl -X POST "$API/messages" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "+228XXXXXXXX",
"body": "Votre dossier est en cours de traitement.",
"priority": "notification",
"idempotency_key": "seed-dossier-1001"
}'
Respuesta 201
{
"message_id": 142,
"ref": "52c22ee01478…",
"phone": "+228XXXXXXXX",
"partner": "seed",
"direction": "out",
"content_type": "text",
"body": "Votre dossier est en cours de traitement.",
"state": "delivered",
"priority": "notification",
"created_at": "2026-07-21 07:10:00"
}
Obtener un mensaje
GET /api/v1/messages/{message_id}
Devuelve el mensaje y los intentos de entrega opcionales.
Enumerar los mensajes
GET /api/v1/messages
| Query | Descripción |
|---|---|
phone | Filtrar por el teléfono de la cuenta |
state | queued · delivered · read · … |
q | Buscar en el cuerpo / contacto |
limit | Tamaño de página |
Marcar como leído / no leído (herramientas para socios)
POST /api/v1/messages/{id}/read
POST /api/v1/messages/{id}/unread
POST /api/v1/messages/read
Envío de chat por un agente
POST /api/v1/agent/messages
Lo utilizan los agentes del Partner Hub. Puede asociarse a una conversación de soporte abierta cuando corresponda. Prefiera /messages para las notificaciones automatizadas del hub.