Documentaci贸n para enviar mensajes de WhatsApp a trav茅s de InnovaAPI.
Todas las solicitudes requieren tu API Key en el header:
| Campo | Tipo | Descripci贸n |
|---|---|---|
numero requerido |
string | N煤mero con c贸digo de pa铆s. Ej: 573001234567 |
tipo requerido |
string | text | image | document | video | audio | location |
mensaje |
string | Texto del mensaje. Requerido si tipo es text |
url |
string | URL del archivo. Requerido para image, document, video, audio |
caption |
string | Texto opcional debajo de la imagen o video |
latitud |
number | Latitud. Requerido para location |
longitud |
number | Longitud. Requerido para location |
nombre |
string | Nombre del lugar. Opcional para location |
const res = await fetch('https://TU_SERVIDOR/api/whatsapp/enviar', {
method: 'POST',
headers: {
'Authorization': 'Bearer TU_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
numero: '573001234567',
tipo: 'text',
mensaje: 'Hola, este es un mensaje de prueba'
})
});
const data = await res.json();
// { success: true, message: 'Mensaje enviado correctamente' }
const res = await fetch('https://TU_SERVIDOR/api/whatsapp/enviar', {
method: 'POST',
headers: {
'Authorization': 'Bearer TU_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
numero: '573001234567',
tipo: 'image',
url: 'https://ejemplo.com/imagen.jpg',
caption: 'Mira esta imagen'
})
});
const res = await fetch('https://TU_SERVIDOR/api/whatsapp/enviar', {
method: 'POST',
headers: {
'Authorization': 'Bearer TU_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
numero: '573001234567',
tipo: 'location',
latitud: 4.7110,
longitud: -74.0086,
nombre: 'Bogot谩, Colombia'
})
});
import requests
headers = {
'Authorization': 'Bearer TU_API_KEY',
'Content-Type': 'application/json'
}
res = requests.post('https://TU_SERVIDOR/api/whatsapp/enviar',
headers=headers,
json={
'numero': '573001234567',
'tipo': 'text',
'mensaje': 'Hola, este es un mensaje de prueba'
}
)
print(res.json())
# {'success': True, 'message': 'Mensaje enviado correctamente'}
res = requests.post('https://TU_SERVIDOR/api/whatsapp/enviar',
headers=headers,
json={
'numero': '573001234567',
'tipo': 'image',
'url': 'https://ejemplo.com/imagen.jpg',
'caption': 'Mira esta imagen'
}
)
res = requests.post('https://TU_SERVIDOR/api/whatsapp/enviar',
headers=headers,
json={
'numero': '573001234567',
'tipo': 'location',
'latitud': 4.7110,
'longitud': -74.0086,
'nombre': 'Bogot谩, Colombia'
}
)
true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer TU_API_KEY',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode([
'numero' => '573001234567',
'tipo' => 'text',
'mensaje'=> 'Hola, este es un mensaje de prueba'
])
]);
$res = json_decode(curl_exec($ch), true);
// ['success' => true, 'message' => 'Mensaje enviado correctamente']
?>
'573001234567',
'tipo' => 'image',
'url' => 'https://ejemplo.com/imagen.jpg',
'caption' => 'Mira esta imagen'
]));
?>
curl -X POST https://TU_SERVIDOR/api/whatsapp/enviar \
-H "Authorization: Bearer TU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"numero":"573001234567","tipo":"text","mensaje":"Hola mundo"}'
curl -X POST https://TU_SERVIDOR/api/whatsapp/enviar \
-H "Authorization: Bearer TU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"numero":"573001234567","tipo":"image","url":"https://ejemplo.com/img.jpg","caption":"Texto"}'
curl -X POST https://TU_SERVIDOR/api/whatsapp/enviar \
-H "Authorization: Bearer TU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"numero":"573001234567","tipo":"document","url":"https://ejemplo.com/doc.pdf"}'
curl -X POST https://TU_SERVIDOR/api/whatsapp/enviar \
-H "Authorization: Bearer TU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"numero":"573001234567","tipo":"location","latitud":4.7110,"longitud":-74.0086,"nombre":"Bogot谩"}'
| C贸digo | Significado |
|---|---|
| 401 | API Key inv谩lida o no enviada |
| 400 | WhatsApp no est谩 conectado o par谩metros incorrectos |
| 429 | L铆mite de mensajes diarios alcanzado |
| 500 | Error interno del servidor |