WA Agent Pro Control Center is an Android-first control center for a personal WhatsApp automation agent. The long-term idea is ambitious: an agent that can understand private messages, remember context, adapt to the relationship with the sender, write in the owner's personal style, and eventually answer across text and voice.
Today, the project is a working prototype foundation: Android captures WhatsApp notifications, stores and syncs messages, a FastAPI backend creates decisions and drafts, and the app gives the operator a serious Review Queue, contact rules, notes, event tickets, logs, and safety controls.
This repository is not just a chat bot experiment. It is a step-by-step attempt to build a controllable personal communication agent.
Disclaimer: this is an independent research/prototype project. It is not affiliated with, endorsed by, or officially supported by WhatsApp, Meta, Google, Gemini, ElevenLabs, or any other platform provider. Android notification, RemoteInput, and Accessibility behavior can change by device, OS version, app version, and policy.
The current UI is a dense, phone-first control center. Contact names in screenshots may be redacted.
| Dashboard | Contacts | Event form |
|---|---|---|
![]() |
![]() |
![]() |
| Contact form | Events empty state | Logs |
|---|---|---|
![]() |
![]() |
![]() |
The original motivation was to build a fully autonomous WhatsApp agent that can reply to private messages in a way that feels natural and personal:
- detect and filter WhatsApp and WhatsApp Business messages;
- identify the sender and react differently for family, work, friends, and unknown contacts;
- understand and remember conversation context;
- generate replies in a personal style, including English, German, and Syrian Arabic;
- use realistic behavior such as delays, small imperfections, and a recognizable personal voice;
- reply automatically when allowed, ideally even when the screen is locked;
- later understand voice messages, transcribe them, answer them, and send voice replies.
The project now treats this vision with a control-center mindset: autonomy should be earned through policy, trust, review, audit, and visible safety state. The agent should not blindly send everything. It should know when to answer, when to ask for review, and when to stay silent.
The long-term target is a personal agent that can handle WhatsApp, Telegram, and email, backed by a learning personality model and a priority system:
- important messages are answered quickly;
- low-priority messages can wait or be ignored;
- sensitive topics go to review;
- each contact can have its own tone, language, delay, and safety rules;
- text replies and voice replies become part of the same decision pipeline.
Voice is part of the future plan:
- collect 10 to 30 minutes of the owner's voice recordings;
- use a TTS provider such as ElevenLabs to generate speech in that voice;
- convert backend output to WhatsApp-compatible
.oggOpus audio; - let Android send the generated audio through an approved share/send flow.
The professional product path is different from the personal Android prototype. For real users and production reliability, the preferred long-term channel is the official WhatsApp Business Platform / Cloud API. The Android automation path is useful for a personal companion, but it remains best-effort and device-dependent.
See VISION.md for the planning roadmap.
The next work is tracked in VISION.md. Current priority themes:
- stabilize Android notification capture, RemoteInput sending, retry, and failure reporting;
- strengthen policy and review gates before increasing autonomy;
- improve contact personality, notes, language, and memory behavior;
- prototype voice-message transcription and reviewed voice replies;
- make event tickets and scheduled communication more reliable;
- prepare a future channel abstraction for WhatsApp Cloud API, Telegram, and email.
- Consolidated the FastAPI backend under
backend/. - Added token-protected backend routes for inbound messages, contacts, notes, queue, event tickets, send attempts, stats, and health.
- Built a SQLAlchemy domain model with contacts, categories, rules, messages, drafts, send attempts, notes, event tickets, event recipients, legacy events, and audit logs.
- Added a migration/seed script for local development data.
- Added Android Room entities for queue/cache data, contacts, notes, events, event tickets, recipients, and send attempts.
- Added Retrofit API integration through
AgentApiServiceand repository wiring. - Implemented Android notification capture through
WhatsAppListener. - Kept RemoteInput as the preferred send path and Accessibility as a fallback path.
- Added WorkManager flows for sync, retry, event-recipient polling, and contact indexing.
- Reworked the Android UI into a phone-first Pro Control Center.
- Restored missing modules in the new UI: event creation form, contact detail/form, and notes management.
- Improved the Review Queue UI with an editable review form, approve/block actions, risk/category/status signals, and failure state.
- Added architecture diagrams in Mermaid and mirrored them into a FigJam board.
- Added documentation for architecture, backend integration, manual testing, UI redesign, and project direction.
- Captures WhatsApp and WhatsApp Business notifications through Android
NotificationListenerService. - Parses inbound messages, stores them locally in Room, and syncs them to the backend.
- Uses backend policy and optional Gemini generation to create draft replies.
- Routes risky or paused replies into a Review Queue before sending.
- Supports direct approval/blocking with editable draft text and failure reasons.
- Sends approved inbound drafts through Android RemoteInput when a valid
custom_idexists. - Uses Accessibility as an optional fallback when RemoteInput is not available.
- Manages contacts, categories, relationship rules, language, active state, and auto mode.
- Adds contact-scoped notes that can be pinned, expired, and used as prompt context.
- Creates event tickets for single contacts or category broadcasts, then prepares recipient drafts.
- Tracks send attempts, retry state, backend health, logs, and operational safety status.
The Android app is designed as a phone-first Pro Control Center:
Dashboard: backend health, permissions, queue pressure, failed sends, newest risks.Review: primary decision surface for draft replies.Contacts: compact control list with contact detail, edit/delete, active toggle, and notes.Events: ticket lifecycle view with event creation and recipient send state.Logs: dense operational log stream with failure signals.
The Compose UI is split into reusable pro modules:
app/src/main/java/com/example/whatsappagent/MainActivity.ktapp/src/main/java/com/example/whatsappagent/ui/pro/ProTokens.ktapp/src/main/java/com/example/whatsappagent/ui/pro/ProComponents.ktapp/src/main/java/com/example/whatsappagent/ui/pro/ProScreens.kt
flowchart LR
User["Operator"] --> Android["Android Pro Control Center"]
WhatsApp["WhatsApp"] --> NLS["Notification Listener"]
NLS --> Room["Room local database"]
Android --> Room
Android --> Repo["Repository + Retrofit"]
Room --> Workers["WorkManager workers"]
Workers --> Repo
Repo --> Backend["FastAPI backend"]
Backend --> DB["SQLAlchemy database"]
Backend --> AI["Gemini client when configured"]
Android --> Sender["RemoteInput / Accessibility sender"]
Sender --> WhatsApp
For detailed diagrams, see docs/architecture_diagrams.md.
.
|-- app/ Android app, Jetpack Compose, Room, WorkManager
|-- backend/ FastAPI backend, SQLAlchemy models, migration script
|-- docs/ Architecture, project specs, test matrix, design notes
|-- gradle/ Gradle wrapper support
|-- .env.example Shared local configuration template
|-- build.gradle.kts Root Gradle config
|-- settings.gradle.kts Android project settings
|-- README.md GitHub project overview
`-- VISION.md Product vision and next-step roadmap
Important Android areas:
WhatsAppListener.kt: notification capture and RemoteInput send path.AutoreplyService.kt: Accessibility fallback sender.worker/SyncWorker.kt: inbound sync, queue polling, event-recipient polling.worker/RetryReplyWorker.kt: retry path for pending or failed replies.worker/ContactIndexerWorker.kt: local contacts indexing and sync.data/: Room entities, DAOs, Retrofit API client, repository.ui/viewmodel/: screen and feature ViewModels.
Important backend areas:
backend/main.py: FastAPI routes and orchestration.backend/database.py: SQLAlchemy entities and enums.backend/migrate.py: schema reset and seed helper.backend/tests/: backend policy and migration tests.
- WhatsApp posts a notification.
- Android notification listener parses sender, phone, text, package, and notification key.
- Message is stored in Room
messages_queue. SyncWorkerposts the inbound message toPOST /messages/inbound.- Backend resolves contact rules, notes, risk, and generation policy.
- Draft becomes either auto-send allowed, review-required, blocked, or failed.
- Review Queue allows editing, approving, blocking, or retrying.
- Android sends approved inbound drafts only when a usable
custom_idexists. - Send attempts are synced back to the backend.
- User creates an event for one contact or a category broadcast.
- Backend creates an
EventTicket. - Preparing a ticket creates
EventRecipientand draft rows. - Approval marks eligible recipients for sending.
- Android polls due event recipients and sends through the normal WhatsApp send path.
- Ticket aggregate state shows prepared, approved, sending, sent, failed, or partial result.
Contacts are managed through backend endpoints and cached locally. Notes are scoped to contacts or categories, can be pinned or expired, and are included in backend prompt context when active.
Most endpoints require:
Authorization: Bearer <APP_API_TOKEN>Core endpoints:
GET /healthGET /statsPOST /messages/inboundPOST /generateGET|POST|PATCH|DELETE /contactsGET|POST|PATCH|DELETE /notesGET|POST|PATCH|DELETE /contacts/{contact_name}/notesGET /queuePATCH /drafts/{draft_id}/decisionPOST /drafts/{draft_id}/send-attemptsPATCH /send-attempts/{attempt_id}GET|POST /event-ticketsPOST /event-tickets/{ticket_id}/preparePOST /event-tickets/{ticket_id}/approvePOST /event-tickets/{ticket_id}/cancelGET /event-recipients/due
- Android Studio with JDK 17.
- Android device or emulator with notification access support.
- Python 3.10+ recommended for the backend.
- A Gemini API key if AI draft generation should be enabled.
- Optional: ngrok or another HTTPS tunnel if the Android device cannot reach the local backend directly.
Copy the example environment file:
Copy-Item .env.example .envSet at least:
GEMINI_API_KEY=your-key
APP_API_TOKEN=dev-token-change-me
DATABASE_URL=sqlite:///./whatsapp_agent.db
BACKEND_BASE_URL=http://10.0.2.2:8000Notes:
APP_API_TOKENmust match between Android and backend.BACKEND_BASE_URLis read by Gradle from.env, Gradle properties, or environment variables.- For a physical Android device, use the LAN IP or tunnel URL instead of
10.0.2.2.
From the repository root:
python -m uvicorn backend.main:app --reloadInitialize or refresh seed data:
python -m backend.migrateReset the local database and seed again:
python -m backend.migrate --resetDefault local database path:
whatsapp_agent.db
Build from the repository root:
.\gradlew.bat :app:assembleDebugIn Android Studio, open the project root and run the app configuration.
On the device, enable the required access:
- Notification access for the WhatsApp listener.
- Notification permission on modern Android versions.
- Contacts permission if contact indexing is needed.
- Accessibility service only if the fallback sender is required.
Android compile check:
.\gradlew.bat :app:compileDebugKotlinAndroid unit tests:
.\gradlew.bat :app:testDebugUnitTestBackend tests:
python -m pytest backend/testsManual scenarios worth checking before a release:
- Backend offline, token mismatch, and failed Gemini generation.
- Empty Review Queue, many drafts, edited approve, block with reason, retry failure.
- Long contact names, inactive contacts, category broadcast, notes with expiry.
- RemoteInput unavailable and Accessibility fallback enabled.
- Event tickets with all sent, partial failure, and due-recipient polling.
- Product vision and roadmap
- Architecture diagrams
- UI redesign and Canva notes
- Manual device test matrix
- Backend integration guide
- Project deep dive
- Agent handbook
- Historical technical vision notes
- Contributing guide
- Security policy
The current FigJam architecture board created from the Mermaid diagrams:
This project handles private messaging data and can act in a user's personal communication space. Treat local databases, logs, screenshots, and exported diagrams as sensitive.
- Do not commit real
.envsecrets. - Do not commit production message databases.
- Review generated replies before enabling auto-send behavior.
- Keep Accessibility fallback explicit and visible to the operator.
- Use a private backend deployment or secured tunnel for real devices.
- Do not use the system to impersonate someone in contexts where disclosure, consent, or legal compliance is required.
The product direction is controlled autonomy: the agent should become more capable over time, but the operator must always be able to see, pause, review, and override it.
Use these topics in the GitHub repository About panel:
android, jetpack-compose, fastapi, whatsapp, automation, ai-agent, personal-assistant, workmanager, room-database, notification-listener, android-accessibility, llm, gemini, python, kotlin
This is an active prototype/control-center implementation. Backend contracts, Android ViewModels, Room cache entities, WorkManager flows, and the Compose Pro UI are present. Production hardening still needs careful review around deployment, data retention, auth, observability, WhatsApp policy, and device-specific send behavior.
Licensed under the Apache License 2.0.





