How luckycoder07/message-notification-router works
Message Notification Router takes messages from Android/WhatsApp and a web tester, enriches them with media, history, and semantics, then selects notify, digest, or mute. The backend’s documented authority is the personalized LearningRouter behind a confidence/validity gate, with deterministic rules as fallback; Gemini enriches rather than decides. Feedback is stored and used for learning, while the web UI exposes testing, analytics, and live events. The README describes these capabilities; sampled source confirms several key call paths, but not every service implementation detail.
Main entry points: service.py API service · main.py FastAPI endpoints · app.js Web visualizer · WhatsAppNotificationService.kt Notification listener
Components 22
Message clients
- Notification listener
mobile/app/src/main/java/com/msgrouter/app/WhatsAppNotificationService.kt - App settings
mobile/app/src/main/java/com/msgrouter/app/SettingsManager.kt - API client
mobile/app/src/main/java/com/msgrouter/app/ApiClient.kt - API contract
mobile/app/src/main/java/com/msgrouter/app/ApiService.kt - Prediction repository
mobile/app/src/main/java/com/msgrouter/app/MessageRepository.kt
API and orchestration
- FastAPI endpoints
code/api/main.py - API service
code/api/service.py - Event broadcaster
code/api/broadcaster.py
Routing pipeline
- Prediction engine
code/src/engine.py - Rule router
code/src/router.py - Feature extraction
code/src/preprocess.py - Media enrichment
code/src/media.py - User history
code/src/history.py - Safety rules
code/src/rules.py - Gemini enrichment
code/src/gemini.py - Prediction output
code/src/output.py
Feedback and learning
- Learning router
code/src/learning.py - Feedback store
code/src/feedback.py
Web interface
- Web visualizer
code/static/app.js
Other components
- Web user
- Message sender
Connections 31
- WhatsApp → Notification listener: posts notification
- Notification listener → App settings: reads settings
- Notification listener → API client: creates client
- API client → API contract: builds service
- Notification listener → API contract: submits message
- API contract → FastAPI endpoints: POST predict
- FastAPI endpoints → API service: dispatches request
- API service → Prediction engine: routes message
- Prediction engine → Rule router: calls router
- Rule router → Feature extraction: extracts features
- Rule router → Media enrichment: processes media
- Rule router → User history: reads history
- Rule router → Safety rules: evaluates rules
- API service → Gemini enrichment: requests enrichment
- API service → Learning router: predicts action
- API service → Feedback store: reads preferences
- API service → Feedback store: records prediction
- Learning router → API service: returns prediction
- API service → Event broadcaster: publishes events
- API service → Feedback store: stores feedback
- API service → FastAPI endpoints: returns result
- FastAPI endpoints → Web visualizer: serves interface
- Web user → Web visualizer: uses tester
- Web visualizer → FastAPI endpoints: requests predictions
- Web visualizer → FastAPI endpoints: requests analytics
- Web visualizer → FastAPI endpoints: opens event stream
- Event broadcaster → FastAPI endpoints: streams events
- Web visualizer → Event broadcaster: receives events
- FastAPI endpoints → API service: submits feedback
- Notification listener → Prediction repository: records prediction
- Message sender → WhatsApp: sends message