The WhatsApp session database (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/chamilonster/Piumy/llms.txt
Use this file to discover all available pages before exploring further.
PIMYWA_SESSION_DB) contains your linked device credentials. If it is lost or corrupted, you must re-link by scanning the QR code again. Piumy can encrypt periodic backups of this file to protect against SD card corruption — the most common failure mode on always-on ARM boards.
Enable backups
Add the following to/opt/pimywa/pimywa.env. Backups are disabled by default — they are never written without an encryption key:
How backups work
Encryption: each backup uses a per-backup random salt fed through scrypt key derivation fromPIMYWA_BACKUP_KEY, then encrypts the snapshot with AES-256-GCM. The session database is never written to disk unencrypted.
Snapshot method: the core uses SQLite’s VACUUM INTO to take a safe, consistent snapshot of the live database file without stopping the WhatsApp gateway.
Triggers — a backup fires on three occasions:
- Periodic — on the
PIMYWA_BACKUP_INTERVALtick (default 24 hours). - Post-link hook — after every successful WhatsApp connect (fresh link and reconnects). Debounced: a flappy-WiFi reconnect storm won’t spam scrypt derivations on a Pi Zero.
- On-demand — via the REST API (see below).
session-<nanosecond-timestamp>.bak. When the count exceeds PIMYWA_BACKUP_KEEP, the oldest are deleted automatically.
Restore from backup
Stop the core service
The restore command refuses to run while
pimywa serve is active, unless you pass --force.Run restore-session
Pass the path to the backup file you want to restore:The command decrypts the backup using
PIMYWA_BACKUP_KEY and replaces the live session database. It will print the source and destination paths on success.--force:
Same-volume warning
Trigger a backup on demand
Use the REST API to take an immediate backup without waiting for the next periodic tick:PIMYWA_BACKUP_KEEP.