Documentation Index
Fetch the complete documentation index at: https://zapo.to/llms.txt
Use this file to discover all available pages before exploring further.
zapo is built for long-lived, multi-session workloads. This page collects the operational decisions that matter once you move past a local prototype.
Persist credentials (don’t re-pair)
Production sessions must use a durable store for theauth and Signal domains, plus a stable sessionId across restarts. The in-memory store loses everything on exit, forcing a re-pair on every boot.
sessionId orphans the previous credentials — treat it as the durable key for a device/account.
Choose a store backend
| Backend | Best for |
|---|---|
@zapo-js/store-sqlite | Single process / single host — the simplest, fastest local option. |
@zapo-js/store-postgres · @zapo-js/store-mysql | Multiple hosts, relational ops, managed backups. |
@zapo-js/store-redis | Low-latency cache + persistence. |
@zapo-js/store-mongo | Document-oriented deployments. |
auth/signal in Postgres, caches in Redis). See Installation and the stores reference.
Graceful shutdown
Calldisconnect() (never logout()) on shutdown — it flushes pending write-behind data and closes the socket without unlinking the device, so the next boot resumes from the store.
Run many sessions
A single store can hold many independent accounts, each keyed bysessionId. Create one WaClient per account:
Tune for throughput
- Write-behind batches incoming message/thread/contact writes off the hot path. Tune
writeBehind.maxPendingKeys/maxWriteConcurrency/flushTimeoutMsto your database. (config) - History sync (
history.enabled) adds a large initial download. Leave it off unless you need backfill, and setrequireFullSyncdeliberately. - Bots that shouldn’t appear online: set
markOnlineOnConnect: false. - Timeouts (
iqTimeoutMs,keepAliveIntervalMs,deadSocketTimeoutMs, …) ship with production defaults — override only with a reason. (config)
Reconnection & error policy
zapo does not auto-reconnect — own the policy. Wire a backoff loop (Reconnection) and classify failures (Errors & disconnects) so you stop on fatal reasons (banned, not_authorized, logout) instead of hammering the server.
Logging
Use a structured logger in production:pretty: false emits JSON lines suited to log aggregators. Drop to debug / trace only when investigating.
Security & versioning
- Credentials are secrets.
WaAuthCredentialsholds the device keys — if you persist them outside the built-in store, encrypt at rest. (Authentication) - Never enable
dangerous.*in production — those flags disable security checks. (config) - Pin exact versions.
zapois pre-1.0; breaking changes are expected until the first major release.
