Skip to content

Send WhatsApp Message for WhatsApp Business QR

Request

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.

Security
api-key
Bodyapplication/json
phone_numberstring

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.

Example:"+593999999999"
customer_idstring

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.

Example:"1713huaxq1352"
platform_retailer_idstring

Identificador de la integración (el id de GET /retailers/api/v1/integrations). Obligatorio cuando el retailer tiene varias integraciones de la plataforma.

Example:"6aa831f6f3c34b7e791c9b96"
messagestring

Mensaje de texto a enviar (requerido si no se envía media_url)

Example:"Hello, this is a test message"
media_urlstring

URL del archivo multimedia (requerido si no se envía message). Solo se permiten imágenes JPG/JPEG/PNG y archivos PDF

Example:"https://mercately.com/example.png"
first_namestring

Nombre del cliente (opcional)

Example:"John"
last_namestring

Apellido del cliente (opcional)

Example:"Doe"
emailstring

Email del cliente (opcional)

Example:"john@example.com"
addressstring

Dirección del cliente (opcional)

Example:"123 Main St"
citystring

Ciudad del cliente (opcional)

Example:"Quito"
statestring

Estado/Provincia del cliente (opcional)

Example:"Pichincha"
zip_codestring

Código postal del cliente (opcional)

Example:"170101"
notesstring

Notas sobre el cliente (opcional)

Example:"Customer notes"
agent_idinteger

ID del agente al que se asignará el cliente (opcional)

Example:980
tagsArray of objects

Array de etiquetas para asignar al cliente (opcional)

Example:
[ { "name": "at", "value": true } ]
custom_fieldsArray of objects

Array de campos personalizados del cliente (opcional)

Example:
[ { "identifier": "custom_field_1", "value": "Some value" } ]
funnel_namestring

Nombre del embudo para crear un deal (opcional, requiere stage)

Example:"Sales Funnel"
stagestring

Etapa del embudo para crear un deal (opcional, requiere funnel_name)

Example:"Lead"
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"
  }'

Responses

OK

Bodyapplication/json
messagestring

Mensaje de confirmación

Example:"Ok"
infoobject(MessageInfo)
Response
{ "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 } }