Para enviar una plantilla de WhatsApp cuando se tiene una conexión oficial al API de WhatsApp, se requieren internal_id y template_params, además de phone_number o customer_id (al menos uno); los demás son opcionales. Si se envían ambos, se usa customer_id; si ese customer_id no existe, se usa phone_number.
Para enviar un mensaje libre (texto o media) que no sea plantilla, usa POST /retailers/api/v1/whatsapp/send_open_message. Si se tiene una conexión vía QR, revisa también la sección de envío de mensajes vía QR.
Número de teléfono del destinatario (formato internacional con +). Se usa cuando no se envía customer_id o cuando ese customer_id no existe.
web_id del cliente (obtenido del endpoint de clientes). Tiene prioridad sobre phone_number. Si no existe, se usa phone_number. Sin phone_number no se crea un cliente nuevo.
Identificador de la integración (el id de GET /retailers/api/v1/integrations). Obligatorio cuando el retailer tiene varias integraciones de la plataforma.
ID interno del template de WhatsApp (gupshup_template_id)
Array de parámetros para rellenar el template
[ "test 1", "test 2", "test 3" ]
URL del archivo multimedia (solo si el template incluye media)
- Production serverhttps://app.mercately.com/retailers/api/v1/whatsapp/send_notification_by_id
- Shops API Production serverhttps://mercately.shop/retailers/api/v1/whatsapp/send_notification_by_id
curl -i -X POST \
https://app.mercately.com/retailers/api/v1/whatsapp/send_notification_by_id \
-H 'Content-Type: application/json' \
-H 'api-key: YOUR_API_KEY_HERE' \
-d '{
"phone_number": "+593999999999",
"customer_id": "1713huaxq1352",
"platform_retailer_id": "6aa831f6f3c34b7e791c9b96",
"internal_id": "997dd550-c8d8-4bf7-ad98-a5ac4844a1ed",
"template_params": [
"test 1",
"test 2",
"test 3"
],
"media_url": "https://mercately.com/example.png",
"agent_id": 980,
"tags": [
[
{
"name": "at",
"value": true
}
]
]
}'{ "message": "Ok", "info": { "channel": "whatsapp", "content": { … }, "direction": "outbound", "status": "submitted", "destination": "+593999999999", "country": "EC", "created_time": "2022-09-23T16:34:16.768-04:00", "error": null } }