Paid Plans4 min read· Updated 2026-11-18
Send WhatsApp via API (5 Langs)
Production-ready code examples in Node.js, Python, cURL, PHP, and C# for sending WhatsApp messages via the Omni Chat Stack Developer API.
Runnable code in 5 languages
Set `OMNICHAT_API_HOST` (e.g., `https://api.omnichatstack.com`) and `OMNICHAT_API_KEY` (`oc_...`) in your server environment variables before running these examples.
POST /api/v1/developer/whatsapp/messages
const host = process.env.OMNICHAT_API_HOST.replace(/\/$/, '');
const apiKey = process.env.OMNICHAT_API_KEY;
async function sendWhatsAppText(to, message) {
const res = await fetch(`${host}/api/v1/developer/whatsapp/messages`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ to, type: 'text', message }),
signal: AbortSignal.timeout(15000),
});
const payload = await res.json();
if (!res.ok || !payload.success) {
throw new Error(payload?.error?.message || `HTTP ${res.status}`);
}
return payload.data;
}
sendWhatsAppText('923152468856', 'Hello from Omni Chat Stack!').then(console.log);