You're offline — showing cached data

Wiki

09-integrations/whatsapp
2026-06-13 07:26:59 SAST
Wiki Home → 09-integrations/whatsapp

WhatsApp Monitoring

WhatsApp monitoring captures messages from Elmar's WhatsApp account using the Baileys library and stores them in a SQLite database for search and context retrieval.

Architecture

How It Works

  1. Connection: Baileys opens a WebSocket connection to WhatsApp servers using stored auth credentials
  2. Message reception: Incoming and outgoing messages trigger the logMessage() handler
  3. Filtering: Messages are checked against whatsapp-config.json rules:
  4. Groups are excluded by default; only whitelisted groups pass through
  5. Newsletters, LIDs, and status broadcasts are always excluded
  6. Excluded contacts, patterns, and noise keywords are filtered out
  7. Deduplication: In-memory set of 500 most recent message IDs prevents double-logging
  8. Content extraction: Handles text, images (with caption), video, documents, audio, location, contacts, polls, and reactions
  9. Persistence: Messages are written to both JSONL log and SQLite database
  10. Reminder extraction: Messages with meaningful content are passed to a reminder extractor (regex + LLM-based)

Data Storage

SQLite Database

JSONL Log

On startup, if the SQLite database is empty, it backfills from the JSONL complete log.

Configuration

Health Check

Memory Management

Outbox (Sending Messages)

The monitor also supports outbound messaging via a JSONL outbox file: - Outbox: /home/lucienne/workspace/data/whatsapp/whatsapp-outbox.jsonl - Results: /home/lucienne/workspace/data/whatsapp/whatsapp-outbox-results.jsonl

Related Files

File Purpose
whatsapp/whatsapp-monitor.js Main monitor script
data/whatsapp/whatsapp-config.json Filter configuration
data/whatsapp/whatsapp-messages.db SQLite message store
scripts/whatsapp_health_check.py Health monitoring
tasks/whatsapp-health-check.md Scheduler task definition
logs/whatsapp/ All log files

Key Takeaways

Help