API Integration Guide
Tutorial · 5 min read
1. Get a key
PC app, Settings, API keys, Generate (or the portal, API keys). Use the test key while building — it sends nothing and returns fake ids. Free Forever includes 1,000 requests + 50 OTP a month; Business 5,000 messages a day; Enterprise unlimited.
2. Send your first message
curl -X POST https://api.bakwa.online/v1/messages \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{"to":"+919816XXXXXX","text":"Your order #4471 is confirmed","kind":"business"}'
Response: {"id":"msg_...","status":"queued","instant":true}. Status changes arrive on your webhook.
3. Send and verify an OTP
POST /v1/otp/send {"to":"+91...","generate":true,"app":"My Shop"} returns an otp_id. Then POST /v1/otp/verify {"otp_id":...,"code":"482913"} returns {"valid":true}. OTPs always go from your Transactional number.
4. Check numbers before you save them
POST /v1/numbers/check {"numbers":["9816012345","9418822110"]} tells you who is reachable, cached 30 days. Save the result on the customer record and stop paying for failed sends.
5. Receive replies
Register a webhook: POST /v1/webhooks {"url":"https://yourapp.com/bakwa","events":["message.incoming","message.status"],"secret":"..."}. Verify X-Signature (HMAC-SHA256 of timestamp + body). Match the sender number to your customer and show the chat on their page.
6. Go live
Swap the test key for the live key, keep the Idempotency-Key header on every write, handle 429 with Retry-After, and watch Usage in the portal. SDKs: npm i bakwa, composer require bakwa/bakwa, pip install bakwa. Full reference: docs.bakwa.online.