Base URL: https://omegaapi.in/api/v1
Har request me apni API key header me bhejo (panel → API Key section se milegi):
X-API-Key: wag_xxxxxxxxxxxxxxxxxxxxxxxx
Alternative: Authorization: Bearer wag_...
Apna account info — balance, agent limit.
{
"email": "client@website.com",
"balance": -1, // -1 = unlimited, 0+ = remaining SMS credits
"allowed_agents": 2,
"created_at": "..."
}
Sabhi aapke agents ki list aur unka live status.
{
"agents": [
{ "id": 1, "label": "OTP Agent", "phone": "919876543210", "status": "live", "connected": true }
]
}
Message bhejna. Balance 1 SMS credit katata hai (agar unlimited nahi).
POST /api/v1/send-text
{
"agentId": 1, // aapka agent ID (GET /agents se milega)
"to": "919876543210", // receiver number (country code ke saath, no +)
"message": "Hello! Your booking is confirmed ✅"
}
Response: { "ok": true, "agentId": 1, "to": "919876543210" }
409 error402 Payment RequiredChat records (received + sent messages). OTP body me hota hai, encrypted DB me.
GET /api/v1/messages?agentId=1&limit=50
{
"messages": [
{ "id": 42, "agentId": 1, "chat": "919876543210@s.whatsapp.net",
"sender": "9198...", "senderName": "John", "body": "Your code is 4821",
"fromMe": false, "hasOtp": true, "timestamp": "..." }
]
}
⚡ Main endpoint: latest incoming OTP (auto-extracted, decrypted on-the-fly). Poll karte raho ya webhook use karo.
GET /api/v1/otp?agentId=1
{
"id": 42, "agentId": 1, "chat": "919876543210@s.whatsapp.net",
"sender": "9198...", "otp": "4821",
"body": "Your code is 4821. Do not share.", "timestamp": "..."
}
OTP abhi nahi aaya → 404. Tip: OTP naye aane pe hi chahiye to apne side pe last OTP id yaad rakho, naya id aaye to process karo.
Apna webhook URL set karo — har incoming message (aur OTP) real-time wahan POST hoga:
POST /api/v1/webhook
{ "url": "https://your-website.com/wa-webhook" }
POST https://your-website.com/wa-webhook
Headers:
Content-Type: application/json
X-Event: message
X-Signature: sha256=<HMAC-SHA256(webhook_secret, raw_body)>
Body:
{
"event": "message",
"agentId": 1,
"chat": "919876543210@s.whatsapp.net",
"sender": "919876543210",
"senderName": "John",
"body": "Your code is 4821",
"otp": "4821", // agar OTP detect hua (warna null)
"timestamp": "2026-11-12T..."
}
Security: signature verify karo taaki sirf gateway se aaye request:
// Node.js example
const expected = 'sha256=' + crypto.createHmac('sha256', WEBHOOK_SECRET).update(rawBody).digest('hex');
if (expected !== req.headers['x-signature']) return res.status(401).end();
// 1. Agent live karo (panel se QR scan)
// 2. Test:
curl -X POST https://omegaapi.in/api/v1/send-text \
-H "X-API-Key: wag_..." \
-H "Content-Type: application/json" \
-d '{"agentId":1,"to":"919876543210","message":"Hi from my website!"}'
// 3. OTP poll:
curl https://omegaapi.in/api/v1/otp?agentId=1 -H "X-API-Key: wag_..."
| Code | Meaning |
|---|---|
| 401 | Invalid/missing API key |
| 402 | Balance khatam (top-up admin se) |
| 403 | Account suspended |
| 404 | Agent/OTP not found |
| 409 | Agent not live (QR scan karo) |