Enviar un mensaje de WhatsApp cuando tienes una conexión oficial por QR. Se requiere phone_number o customer_id (al menos uno) y message (o media_url), el resto de parámetros son opcionales. Si se envían ambos, se usa customer_id; si ese customer_id no existe, se usa phone_number. El cliente debe tener teléfono o user_id; si no, responde 422.
Este endpoint es solo para QR y solo acepta imágenes JPG/JPEG/PNG y documentos PDF. Para enviar texto o media (imagen, documento, audio o video) por cualquier línea, oficial (BSP/Gupshup) o QR, usa POST /retailers/api/v1/whatsapp/send_open_message.
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.
Mensaje de texto a enviar (requerido si no se envía media_url)
URL del archivo multimedia (requerido si no se envía message). Solo se permiten imágenes JPG/JPEG/PNG y archivos PDF
Array de campos personalizados del cliente (opcional)
[ { "identifier": "custom_field_1", "value": "Some value" } ]
Nombre del embudo para crear un deal (opcional, requiere stage)
- Production serverhttps://app.mercately.com/retailers/api/v1/whatsapp/send_message
- Shops API Production serverhttps://mercately.shop/retailers/api/v1/whatsapp/send_message
curl -i -X POST \
https://app.mercately.com/retailers/api/v1/whatsapp/send_message \
-H 'Content-Type: application/json' \
-H 'api-key: YOUR_API_KEY_HERE' \
-d '{
"phone_number": "+593999999999",
"customer_id": "1713huaxq1352",
"platform_retailer_id": "6aa831f6f3c34b7e791c9b96",
"message": "Hello, this is a test message",
"media_url": "https://mercately.com/example.png",
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"address": "123 Main St",
"city": "Quito",
"state": "Pichincha",
"zip_code": "170101",
"notes": "Customer notes",
"agent_id": 980,
"tags": [
{
"name": "at",
"value": true
}
],
"custom_fields": [
{
"identifier": "custom_field_1",
"value": "Some value"
}
],
"funnel_name": "Sales Funnel",
"stage": "Lead"
}'{ "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 } }