✉️ Enviar mensajes unitarios por API

Texto, imágenes, audio, documentos, stickers, ubicación y contacto usando POST /api/send-message.

Si quieres enviar un mensaje (no campañas), usa POST /api/send-message. Sólo necesitas tu instanceId, token y el destino.

  • Destino: número con indicativo (ej: 573001112233) o JID (ej: 573001112233@c.us).
  • Tipos: text, image, video, audio, document, sticker, location, contact.
  • Para campañas, usa /api/bulk.

Personaliza tus datos

El ID numérico de tu instancia
Lo ves en Dashboard → Instancia
Número con indicativo o JID
Los botones “Copiar” usarán tus valores.

1) Enviar texto

curl -X POST https://whapi.co/api/send-message \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": 123,
    "token": "TOKEN_DE_TU_INSTANCIA",
    "to": "573001112233",
    "type": "text",
    "message": "Hola 👋 desde whapi.co"
  }'
fetch('https://whapi.co/api/send-message', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    instanceId: 123,
    token: "TOKEN_DE_TU_INSTANCIA",
    to: "573001112233",
    type: "text",
    message: "Hola 👋 desde whapi.co"
  })
})
.then(r => r.json())
.then(console.log)
.catch(console.error);
const axios = require('axios');

axios.post('https://whapi.co/api/send-message', {
  instanceId: 123,
  token: "TOKEN_DE_TU_INSTANCIA",
  to: "573001112233",
  type: "text",
  message: "Hola 👋 desde whapi.co"
}).then(res => {
  console.log(res.data);
}).catch(console.error);
import requests

resp = requests.post('https://whapi.co/api/send-message', json={
  "instanceId": 123,
  "token": "TOKEN_DE_TU_INSTANCIA",
  "to": "573001112233",
  "type": "text",
  "message": "Hola 👋 desde whapi.co"
})
print(resp.json())
<?php
$payload = [
  "instanceId" => 123,
  "token" => "TOKEN_DE_TU_INSTANCIA",
  "to" => "573001112233",
  "type" => "text",
  "message" => "Hola 👋 desde whapi.co"
];

$ch = curl_init("https://whapi.co/api/send-message");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode($payload),
  CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
if ($response === false) {
  die("cURL error: " . curl_error($ch));
}
curl_close($ch);
echo $response;
?>

2) Enviar imagen

curl -X POST https://whapi.co/api/send-message \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": 123,
    "token": "TOKEN_DE_TU_INSTANCIA",
    "to": "573001112233",
    "type": "image",
    "media": "https://mi-cdn.com/foto.jpg",
    "caption": "Nueva carta 🍝"
  }'
fetch('https://whapi.co/api/send-message', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    instanceId: 123,
    token: "TOKEN_DE_TU_INSTANCIA",
    to: "573001112233",
    type: "image",
    media: "https://mi-cdn.com/foto.jpg",
    caption: "Nueva carta 🍝"
  })
})
.then(r => r.json())
.then(console.log)
.catch(console.error);
const axios = require('axios');

axios.post('https://whapi.co/api/send-message', {
  instanceId: 123,
  token: "TOKEN_DE_TU_INSTANCIA",
  to: "573001112233",
  type: "image",
  media: "https://mi-cdn.com/foto.jpg",
  caption: "Nueva carta 🍝"
}).then(res => console.log(res.data))
.catch(console.error);
import requests

resp = requests.post('https://whapi.co/api/send-message', json={
  "instanceId": 123,
  "token": "TOKEN_DE_TU_INSTANCIA",
  "to": "573001112233",
  "type": "image",
  "media": "https://mi-cdn.com/foto.jpg",
  "caption": "Nueva carta 🍝"
})
print(resp.json())
<?php
$payload = [
  "instanceId" => 123,
  "token" => "TOKEN_DE_TU_INSTANCIA",
  "to" => "573001112233",
  "type" => "image",
  "media" => "https://mi-cdn.com/foto.jpg",
  "caption" => "Nueva carta 🍝"
];

$ch = curl_init("https://whapi.co/api/send-message");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode($payload),
  CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
if ($response === false) {
  die("cURL error: " . curl_error($ch));
}
curl_close($ch);
echo $response;
?>

Documento

curl -X POST https://whapi.co/api/send-message \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": 123,
    "token": "TOKEN_DE_TU_INSTANCIA",
    "to": "573001112233",
    "type": "document",
    "media": "https://mi-cdn.com/manual.pdf",
    "filename": "manual.pdf"
  }'
fetch('https://whapi.co/api/send-message', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    instanceId: 123,
    token: "TOKEN_DE_TU_INSTANCIA",
    to: "573001112233",
    type: "document",
    media: "https://mi-cdn.com/manual.pdf",
    filename: "manual.pdf"
  })
}).then(r => r.json()).then(console.log).catch(console.error);
const axios = require('axios');

axios.post('https://whapi.co/api/send-message', {
  instanceId: 123,
  token: "TOKEN_DE_TU_INSTANCIA",
  to: "573001112233",
  type: "document",
  media: "https://mi-cdn.com/manual.pdf",
  filename: "manual.pdf"
}).then(res => console.log(res.data)).catch(console.error);
import requests

resp = requests.post('https://whapi.co/api/send-message', json={
  "instanceId": 123,
  "token": "TOKEN_DE_TU_INSTANCIA",
  "to": "573001112233",
  "type": "document",
  "media": "https://mi-cdn.com/manual.pdf",
  "filename": "manual.pdf"
})
print(resp.json())
<?php
$payload = [
  "instanceId" => 123,
  "token" => "TOKEN_DE_TU_INSTANCIA",
  "to" => "573001112233",
  "type" => "document",
  "media" => "https://mi-cdn.com/manual.pdf",
  "filename" => "manual.pdf"
];

$ch = curl_init("https://whapi.co/api/send-message");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode($payload),
  CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
if ($response === false) {
  die("cURL error: " . curl_error($ch));
}
curl_close($ch);
echo $response;
?>

Audio (nota de voz)

curl -X POST https://whapi.co/api/send-message \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": 123,
    "token": "TOKEN_DE_TU_INSTANCIA",
    "to": "573001112233",
    "type": "audio",
    "media": "https://mi-cdn.com/audio.ogg"
  }'
fetch('https://whapi.co/api/send-message', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    instanceId: 123,
    token: "TOKEN_DE_TU_INSTANCIA",
    to: "573001112233",
    type: "audio",
    media: "https://mi-cdn.com/audio.ogg"
  })
}).then(r => r.json()).then(console.log).catch(console.error);
const axios = require('axios');

axios.post('https://whapi.co/api/send-message', {
  instanceId: 123,
  token: "TOKEN_DE_TU_INSTANCIA",
  to: "573001112233",
  type: "audio",
  media: "https://mi-cdn.com/audio.ogg"
}).then(res => console.log(res.data)).catch(console.error);
import requests

resp = requests.post('https://whapi.co/api/send-message', json={
  "instanceId": 123,
  "token": "TOKEN_DE_TU_INSTANCIA",
  "to": "573001112233",
  "type": "audio",
  "media": "https://mi-cdn.com/audio.ogg"
})
print(resp.json())
<?php
$payload = [
  "instanceId" => 123,
  "token" => "TOKEN_DE_TU_INSTANCIA",
  "to" => "573001112233",
  "type" => "audio",
  "media" => "https://mi-cdn.com/audio.ogg"
];

$ch = curl_init("https://whapi.co/api/send-message");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode($payload),
  CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
if ($response === false) {
  die("cURL error: " . curl_error($ch));
}
curl_close($ch);
echo $response;
?>

Sticker

curl -X POST https://whapi.co/api/send-message \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": 123,
    "token": "TOKEN_DE_TU_INSTANCIA",
    "to": "573001112233",
    "type": "sticker",
    "media": "https://mi-cdn.com/sticker.png"
  }'
fetch('https://whapi.co/api/send-message', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    instanceId: 123,
    token: "TOKEN_DE_TU_INSTANCIA",
    to: "573001112233",
    type: "sticker",
    media: "https://mi-cdn.com/sticker.png"
  })
}).then(r => r.json()).then(console.log).catch(console.error);
const axios = require('axios');

axios.post('https://whapi.co/api/send-message', {
  instanceId: 123,
  token: "TOKEN_DE_TU_INSTANCIA",
  to: "573001112233",
  type: "sticker",
  media: "https://mi-cdn.com/sticker.png"
}).then(res => console.log(res.data)).catch(console.error);
import requests

resp = requests.post('https://whapi.co/api/send-message', json={
  "instanceId": 123,
  "token": "TOKEN_DE_TU_INSTANCIA",
  "to": "573001112233",
  "type": "sticker",
  "media": "https://mi-cdn.com/sticker.png"
})
print(resp.json())
<?php
$payload = [
  "instanceId" => 123,
  "token" => "TOKEN_DE_TU_INSTANCIA",
  "to" => "573001112233",
  "type" => "sticker",
  "media" => "https://mi-cdn.com/sticker.png"
];

$ch = curl_init("https://whapi.co/api/send-message");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode($payload),
  CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
if ($response === false) {
  die("cURL error: " . curl_error($ch));
}
curl_close($ch);
echo $response;
?>

3) Enviar ubicación

curl -X POST https://whapi.co/api/send-message \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": 123,
    "token": "TOKEN_DE_TU_INSTANCIA",
    "to": "573001112233",
    "type": "location",
    "latitude": 4.7110,
    "longitude": -74.0721
  }'
fetch('https://whapi.co/api/send-message', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    instanceId: 123,
    token: "TOKEN_DE_TU_INSTANCIA",
    to: "573001112233",
    type: "location",
    latitude: 4.7110,
    longitude: -74.0721
  })
}).then(r => r.json()).then(console.log).catch(console.error);
const axios = require('axios');

axios.post('https://whapi.co/api/send-message', {
  instanceId: 123,
  token: "TOKEN_DE_TU_INSTANCIA",
  to: "573001112233",
  type: "location",
  latitude: 4.7110,
  longitude: -74.0721
}).then(res => console.log(res.data)).catch(console.error);
import requests

resp = requests.post('https://whapi.co/api/send-message', json={
  "instanceId": 123,
  "token": "TOKEN_DE_TU_INSTANCIA",
  "to": "573001112233",
  "type": "location",
  "latitude": 4.7110,
  "longitude": -74.0721
})
print(resp.json())
<?php
$payload = [
  "instanceId" => 123,
  "token" => "TOKEN_DE_TU_INSTANCIA",
  "to" => "573001112233",
  "type" => "location",
  "latitude" => 4.7110,
  "longitude" => -74.0721
];

$ch = curl_init("https://whapi.co/api/send-message");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode($payload),
  CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
if ($response === false) {
  die("cURL error: " . curl_error($ch));
}
curl_close($ch);
echo $response;
?>

4) Enviar contacto (vCard)

curl -X POST https://whapi.co/api/send-message \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": 123,
    "token": "TOKEN_DE_TU_INSTANCIA",
    "to": "573001112233",
    "type": "contact",
    "vcard": "BEGIN:VCARD\nVERSION:3.0\nFN:Soporte Whapi\nTEL;TYPE=CELL:+573001234567\nEND:VCARD"
  }'
fetch('https://whapi.co/api/send-message', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    instanceId: 123,
    token: "TOKEN_DE_TU_INSTANCIA",
    to: "573001112233",
    type: "contact",
    vcard: `BEGIN:VCARD
VERSION:3.0
FN:Soporte Whapi
TEL;TYPE=CELL:+573001234567
END:VCARD`
  })
}).then(r => r.json()).then(console.log).catch(console.error);
const axios = require('axios');

axios.post('https://whapi.co/api/send-message', {
  instanceId: 123,
  token: "TOKEN_DE_TU_INSTANCIA",
  to: "573001112233",
  type: "contact",
  vcard: 'BEGIN:VCARD\nVERSION:3.0\nFN:Soporte Whapi\nTEL;TYPE=CELL:+573001234567\nEND:VCARD'
}).then(res => console.log(res.data)).catch(console.error);
import requests

resp = requests.post('https://whapi.co/api/send-message', json={
  "instanceId": 123,
  "token": "TOKEN_DE_TU_INSTANCIA",
  "to": "573001112233",
  "type": "contact",
  "vcard": "BEGIN:VCARD\nVERSION:3.0\nFN:Soporte Whapi\nTEL;TYPE=CELL:+573001234567\nEND:VCARD"
})
print(resp.json())
<?php
$payload = [
  "instanceId" => 123,
  "token" => "TOKEN_DE_TU_INSTANCIA",
  "to" => "573001112233",
  "type" => "contact",
  "vcard" => "BEGIN:VCARD\nVERSION:3.0\nFN:Soporte Whapi\nTEL;TYPE=CELL:+573001234567\nEND:VCARD"
];

$ch = curl_init("https://whapi.co/api/send-message");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode($payload),
  CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
if ($response === false) {
  die("cURL error: " . curl_error($ch));
}
curl_close($ch);
echo $response;
?>

Consejos rápidos

  • Si ves errores de “número inválido”, convierte primero el número a JID con /api/resolve-number.
  • Para adjuntos, usa URLs públicas (CDN o servidor de archivos accesible).
  • Las confirmaciones (ack) y eventos los recibes por SSE o vía webhook.