Meta WhatsApp Cloud API-এর মতো full REST API। Webhooks, broadcasts, templates, media — সব ready।
সব request-এ header পাঠান:
Authorization: Bearer kh_live_xxxxxxxxxxxx # or X-API-Key: kh_live_xxxxxxxxxxxx
Base URL: https://chat.biggaponbd.com
/api/v1/messages/sendSend a message by phone or username (auto-creates conversation)
{ "to": "+8801XXXXXXXXX", "type": "text", "content": "Hello!" }/api/v1/messages/status?message_id=xxxGet per-recipient sent/delivered/read status
/api/v1/webhooksList webhook subscriptions
/api/v1/webhooksCreate a webhook (returns signing secret once)
{ "url": "https://yoursite.com/hook", "events": ["message.received","message.delivered","message.read"] }/api/v1/webhooks?id=xxxDelete a webhook
/api/v1/contactsList/search saved contacts
/api/v1/contactsCreate or upsert a contact (auto-links to KHapps user)
{ "phone": "+8801XXXXXXXXX", "display_name": "John" }/api/v1/templatesList your message templates
/api/v1/templatesCreate a template with {{1}} {{2}} variables
{ "name": "order_confirm", "body": "Hi {{1}}, your order #{{2}} is confirmed." }/api/v1/broadcastSend to many recipients at once (max 1000)
{ "recipients": [{"phone":"+8801..."}], "template": {"name":"order_confirm","variables":{"1":"John","2":"123"}} }/api/v1/broadcast?id=xxxGet broadcast job status
/api/v1/media/uploadUpload image/file (multipart, max 25MB) — returns file_url
/api/v1/analytics?days=7Message stats: sent / delivered / read / failed
/api/v1/conversationsList conversations
/api/v1/conversations/:id/messagesGet messages in a thread
/api/v1/conversations/:id/messagesReply in an existing thread
/api/v1/meGet authenticated user profile
/api/v1/ai/chatAI chat (Lovable AI Gateway)
Subscribe করার পর আপনার URL-এ POST request আসবে এই headers সহ:
X-KHapps-Event: message.received X-KHapps-Signature: t=1730000000,v1=<hmac-sha256-hex> X-KHapps-Delivery: <delivery-uuid> Content-Type: application/json
Verify signature: HMAC-SHA256(secret, `$${timestamp$}.$${rawBody$}`)
message.receivedIncoming message arrived in your conversation
message.sentYour outbound message was created
message.deliveredMessage reached the recipient's device
message.readRecipient opened/read the message
message.failedDelivery failed
contact.createdNew contact added
broadcast.completedBulk send job finished
// Send a message by phone number
const res = await fetch("https://chat.biggaponbd.com/api/v1/messages/send", {
method: "POST",
headers: {
"Authorization": "Bearer kh_live_xxxxx",
"Content-Type": "application/json"
},
body: JSON.stringify({
to: "+8801712345678",
type: "text",
content: "Hello from my new app!"
})
});
const data = await res.json();
// { success: true, message_id: "...", conversation_id: "...", status: "sent" }Webhooks queue হয় database-এ। Deliver করতে এই URL-এ প্রতি 30 sec এ একটা cron hit করুন:
GET https://chat.biggaponbd.com/api/public/webhook-process
যেকোনো cron service (cron-job.org, EasyCron, GitHub Actions) দিয়ে setup করতে পারেন।