Internal documentation for developers. This page covers the WhatsApp Business API integration: session lifecycle, webhook architecture, and routing patterns. Not intended for end users.
Route Map
Architecture Overview
Session Lifecycle
1. Pairing (QR Code or Phone Number)
Two pairing methods: QR Code flow:2. Session States
3. Disconnect
Webhook Event Processing
WhatsApp sends all events (messages, status updates, read receipts) to the webhook endpoint. Required for webhook:- Public HTTPS URL
- Verified with Meta’s challenge-response handshake
Signature verification:
Agent Assignment
Conversation Resolution
Meta OAuth Callback
When connecting a WhatsApp Business Account via Meta’s OAuth:Environment Variables Required
Known Issues / Gotchas
- Webhook re-delivery: Meta retries webhook delivery if your server returns non-2xx. Ensure idempotent message processing using
whatsapp_message_idas dedup key. - Session expiry: WhatsApp sessions (for personal numbers via unofficial API) expire after 20 days of inactivity. Business API sessions don’t expire but phone numbers can be disconnected.
- QR code polling: The QR code is short-lived (~60 seconds). Frontend must regenerate if expired before scanning.
- Rate limits: The WhatsApp Business API enforces per-phone-number rate limits for outbound messages. Monitor for
131056(spam rate limit) errors. - 24-hour messaging window: Businesses can only proactively message users who messaged within the last 24 hours (without pre-approved templates).

