Enviar mensajes

Envía y gestiona mensajes de WhatsApp desde tu aplicación.

Campos comunes

  • session — nombre de la sesión desde la que envías el mensaje.
  • chatId — identificador del destino: 5215551234567@c.us (usuario), ...@g.us (grupo), ...@newsletter (canal) o status@broadcast (estado).
  • file — para multimedia, usa file.url (URL pública) o file.data (base64).
  • reply_to — ID del mensaje al que respondes.

Marcar como leído

http
POST /api/sendSeen
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us"
}

Para leer mensajes específicos, usa messagesIds (y participant en grupos):

jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "messagesIds": [
    "false_5215551234567@c.us_AAAAAAAAAAAAAAAAAAAA"
  ]
}

Enviar texto

http
POST /api/sendText
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "text": "¡Hola!"
}

Opciones adicionales:

  • reply_to — responder a un mensaje.
  • mentions — mencionar contactos en un grupo (["5215551234567@c.us"] o ["all"] para todos).
  • linkPreview — activar vista previa de enlaces.
  • linkPreviewHighQuality — vista previa en alta calidad.

Enviar imagen

http
POST /api/sendImage
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "file": {
    "mimetype": "image/jpeg",
    "url": "https://ejemplo.com/foto.jpg",
    "filename": "foto.jpg"
  },
  "caption": "Mira esta imagen"
}

También puedes enviar el archivo en base64 usando file.data en lugar de file.url.

Enviar nota de voz

http
POST /api/sendVoice
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "file": {
    "mimetype": "audio/ogg; codecs=opus",
    "url": "https://ejemplo.com/audio.ogg"
  },
  "convert": false
}

Usa convert: true para que Wazend convierta el audio automáticamente. También puedes enviar el archivo en base64 con file.data.

Enviar video

http
POST /api/sendVideo
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "file": {
    "mimetype": "video/mp4",
    "url": "https://ejemplo.com/video.mp4"
  },
  "caption": "Mira este video",
  "convert": false
}

Usa convert: true para que Wazend convierta el video automáticamente.

Convertir voz

Convierte un audio a un formato compatible con WhatsApp (OGG/Opus).

http
POST /api/{session}/media/convert/voice
jsonBody
{
  "url": "https://ejemplo.com/audio.mp3"
}

Convertir video

Convierte un video a formato MP4.

http
POST /api/{session}/media/convert/video
jsonBody
{
  "url": "https://ejemplo.com/video.avi"
}

Enviar archivo

http
POST /api/sendFile
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "file": {
    "mimetype": "application/pdf",
    "url": "https://ejemplo.com/documento.pdf",
    "filename": "documento.pdf"
  },
  "caption": "Aquí el documento"
}

Enviar encuesta

http
POST /api/sendPoll
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "poll": {
    "name": "¿Cuál es tu color favorito?",
    "options": ["Rojo", "Azul", "Verde"],
    "multipleAnswers": false
  }
}

Votar en encuesta

http
POST /api/sendPollVote
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "pollMessageId": "ID_DE_LA_ENCUESTA",
  "pollServerId": null,
  "votes": ["Rojo"]
}

Enviar lista interactiva

http
POST /api/sendList
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "title": "Menú principal",
  "text": "Selecciona una opción",
  "buttonText": "Abrir menú",
  "sections": [
    {
      "title": "Opciones",
      "rows": [
        { "title": "Opción 1", "description": "Descripción 1" },
        { "title": "Opción 2", "description": "Descripción 2" }
      ]
    }
  ]
}

Enviar link con vista previa personalizada

http
POST /api/send/link-custom-preview
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "title": "Título personalizado",
  "description": "Descripción del enlace",
  "url": "https://ejemplo.com",
  "imageUrl": "https://ejemplo.com/preview.jpg"
}

Reenviar mensaje

http
POST /api/forwardMessage
jsonBody
{
  "session": "S0001",
  "messageId": "false_5215551234567@c.us_ABC123",
  "chatId": "5219999999999@c.us"
}

Reaccionar a un mensaje

http
POST /api/reaction
jsonBody
{
  "session": "S0001",
  "messageId": "false_5215551234567@c.us_ABC123",
  "chatId": "5215551234567@c.us",
  "reaction": "👍"
}

Destacar mensaje

http
POST /api/star
jsonBody
{
  "session": "S0001",
  "messageId": "false_5215551234567@c.us_ABC123",
  "chatId": "5215551234567@c.us",
  "star": true
}

Enviar contacto

http
POST /api/sendContactVcard
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "contacts": [
    { "fullName": "Juan Pérez", "phoneNumber": "+5215551234567" }
  ]
}

Enviar ubicación

http
POST /api/sendLocation
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us",
  "lat": 19.4326,
  "lng": -99.1332,
  "title": "Ciudad de México"
}

Indicador de escritura

http
POST /api/startTyping
jsonBody
{
  "session": "S0001",
  "chatId": "5215551234567@c.us"
}
http
POST /api/stopTyping