Concepts
Connections
How WhatsApp connections work in WAHooks
A connection is a linked WhatsApp account. When you create a connection, WAHooks provisions a cloud-hosted WAHA session that maintains the WhatsApp Web connection on your behalf.
Architecture
Your App → WAHooks API → WAHA Worker Pod → WhatsAppEach connection runs in its own isolated container (WAHA pod) in the WAHooks Kubernetes cluster. The pod handles:
- WhatsApp Web protocol (NOWEB engine)
- Message sending and receiving
- Event forwarding to the WAHooks API
- Session persistence (survives pod restarts)
Session lifecycle
- Create (
pending) — a WAHA pod is provisioned and a session is created - QR Scan (
scan_qr) — you scan a QR code with WhatsApp to link the account - Connected (
connected) — the session is active, messages flow in and out - Failed (
failed) — the session lost connection. Most failures recover on their own within a few minutes;failureReasonsays when one needs you:logged_out— WhatsApp removed the linked device (Linked devices → Log out on the phone). Fetch a new QR code (GET /api/connections/:id/qr) and scan it to reconnect.qr_expired— a QR code was shown and not scanned in time. Fetch a new one.null— a temporary failure WAHooks is retrying.
- Stopped (
stopped) — you deleted the connection
Health monitoring
WAHooks polls WAHA sessions every 3 minutes:
- FAILED sessions are restarted from their saved credentials, up to 5 times. A session WhatsApp logged out has no credentials left, so it's marked
failedwithfailureReason: "logged_out"at once instead of showing QR codes nobody scans - STOPPED sessions that should be active are restarted
- Missing sessions (after pod restart) are auto-created with full config
One session per number
Each WhatsApp number can only be linked to one connection at a time. Creating a new connection for a number that's already linked elsewhere will unlink the existing session.
Chat IDs
WhatsApp uses specific ID formats:
| Type | Format | Example |
|---|---|---|
| Individual | {country}{phone}@s.whatsapp.net | 1234567890@s.whatsapp.net |
| Group | {id}@g.us | 120363419246216126@g.us |
Use the chats endpoint to discover chat IDs.