Skip to content

Configuration ​

Set these as environment variables or in .env. See .env.example for the full list.

Required ​

VariableNotes
DATABASE_URLPostgreSQL connection string. Tables are created on first boot.
ADMIN_EMAILSComma-separated addresses allowed to sign in to the dashboard.
RESEND_API_KEY, RESEND_FROM_EMAILSend sign-in codes. Required in production. Without them, outside production, codes are printed to the log.
KEY_ENCRYPTION_SECRETRandom, 16+ characters. Encrypts stored API keys and WhatsApp sessions. Required in production.

Server ​

VariableDefaultNotes
PORT3000
NODE_ENVproduction turns on startup checks.
TRUST_PROXYSet 1 behind nginx, Caddy or a load balancer.
ADMIN_API_KEYOptional x-admin-key for scripts. 16+ characters in production. Unset disables it.
AUTOSTART_CLIENTS10 starts the server without booting WhatsApp clients.
RATE_LIMIT_PER_MINUTE30Default send limit per app.

WhatsApp sessions ​

VariableDefaultNotes
SESSION_STOREpostgreslocal keeps sessions on disk only.
SESSIONS_DIRdata/sessionsWorking copy of browser profiles.
SESSION_BACKUP_MINUTES10How often a running session is saved to the database.
SESSION_INACTIVE_DAYS7Delete stored sessions of apps offline this long. 0 never deletes.
PUPPETEER_EXECUTABLE_PATHautoChrome or Chromium to use.
PUPPETEER_PROXY_SERVERRoute the browser through an egress proxy.
PUPPETEER_IGNORE_HTTPS_ERRORSDevelopment only, never in production.
SEND_CONFIRM_WAIT_MS5000How long to wait for a sent message id.
CLIENT_INIT_TIMEOUT_MS180000A client still starting after this long is restarted.
RECONNECT_BASE_MS, RECONNECT_MAX_MS5000, 300000Reconnect backoff.

Webhooks and retention ​

VariableDefault
WEBHOOK_TIMEOUT_MS8000
WEBHOOK_MAX_ATTEMPTS10
WEBHOOK_RETRY_BASE_MS30000
WEBHOOK_MAX_DELAY_MS3600000
WEBHOOK_CONCURRENCY5
WEBHOOK_RETENTION_DAYS7
MESSAGE_RETENTION_DAYS7

Provisioning ​

VariableDefault
PROVISION_MAX_APPS100
PROVISION_CREATES_PER_HOUR30

Database notes ​

Run the gateway in the same region as the database, since every API request does a key lookup. Use a separate database for development. To move from the old SQLite version, run node scripts/migrate-sqlite-to-postgres.js --dry-run and then without --dry-run. WhatsApp logins are not migrated, so each app shows a QR once.

Released under the Apache-2.0 License.