Run a coding CLI (codex / claude) behind a dedicated WhatsApp number.
Project description
whatsapp-agent
Run a coding CLI behind a dedicated WhatsApp number.
whatsapp-agent installs a WhatsApp bridge on a server, connects it to a local CLI agent, and keeps per-chat session state so you can message your server like a real operator instead of SSHing in every time.
Features
- Supports multiple backends:
codexclaude
- Guided installer with menu-based setup for the common choices
- Dedicated WhatsApp bridge using Baileys
- Persistent per-chat agent sessions
- Per-chat root, model, title, saved sessions, and compacted summaries
systemd --userservice for long-running deployment- Isolated WhatsApp setup that does not need to reuse your existing Telegram or other agent integrations
How it works
The package runs two pieces:
bridge/bridge.jsConnects to WhatsApp and exposes a small local HTTP bridge.server/gateway.pyPolls the bridge for incoming messages, routes each chat into the selected CLI backend, and sends replies back to WhatsApp.
Each WhatsApp chat gets its own persisted session state, so one chat can stay pointed at one repo while another chat works somewhere else.
Supported backends
codexclaude
The installer asks which backend you want to control. The selected CLI must already be installed and authenticated on the server.
Requirements
- Linux server with
systemd --user - Node.js 18+
- Python 3.11+ or
uv - One of:
codexclaude
- A WhatsApp account or number to pair with the bridge
Install
Quick install (PyPI)
# zero-install run with uv
uvx whatsapp-agent-cli install
# or as a persistent tool
uv tool install whatsapp-agent-cli
whatsapp-agent install
# or classic pip
pip install whatsapp-agent-cli
whatsapp-agent install
The CLI exposes:
whatsapp-agent install [--reconfigure] [--non-interactive]
whatsapp-agent pair # re-pair WhatsApp (prints QR)
whatsapp-agent run # foreground gateway (no systemd)
whatsapp-agent service start|stop|status|restart|logs
whatsapp-agent doctor # diagnose the install
whatsapp-agent path # print the install dir
whatsapp-agent --version
From source
git clone https://github.com/kalki-kgp/whatsapp-agent-cli.git
cd whatsapp-agent-cli
bash scripts/install.sh
Both paths run the same interactive TUI (arrow keys to pick, Enter to confirm). It will:
- auto-detect
claudeandcodexon yourPATHand pick one - ask whether to run in
botorself-chatmode - ask for your allowed WhatsApp number(s)
- pick the next free bridge port starting at
3010 - hide root / model / port / CLI-path behind an opt-in Advanced toggle
- show a review screen, then install Python + Node deps, write
.env, and install the user service - offer to pair WhatsApp immediately
By default, the runtime is installed into ~/.agent-whatsapp and the service is named agent-whatsapp.service.
Installer flags
bash scripts/install.sh --reconfigure # re-run prompts using values from existing .env as defaults
bash scripts/install.sh --non-interactive # no prompts; uses env vars + auto-detect (CI-friendly)
bash scripts/install.sh --help # full flag + env-var reference
In --non-interactive mode the only required input is WHATSAPP_ALLOWED_USERS. Everything else falls back to auto-detection or the saved .env.
Pairing
If you skip pairing during install, run:
bash ~/.agent-whatsapp/scripts/pair.sh
That prints a QR code in the terminal. Scan it with WhatsApp and the session will be stored under:
~/.agent-whatsapp/whatsapp/session
Running
Start the service:
systemctl --user start agent-whatsapp.service
Check status:
systemctl --user status agent-whatsapp.service --no-pager
Inspect logs:
journalctl --user -u agent-whatsapp.service -n 100 --no-pager
Stop it:
systemctl --user stop agent-whatsapp.service
Configuration
The installer writes ~/.agent-whatsapp/.env.
Important settings:
AGENT_BACKENDcodexorclaudeAGENT_COMMANDPath or command name for the selected CLIAGENT_MODELOptional default modelAGENT_ROOTDefault working directoryWHATSAPP_MODEbotorself-chatWHATSAPP_ALLOWED_USERSComma-separated phone numbers or WhatsApp IDs allowed to talk to the bridgeWHATSAPP_PORTLocal bridge port
For allowlisting, full international format is the safest, for example:
WHATSAPP_ALLOWED_USERS=917385166726
The bridge is also tolerant of common suffix-only input and LID mappings, but full country-code format is still the cleanest option.
Chat commands
/statusShow backend, root, active thread, model, summary state, and saved-session count./newArchive the current session and start fresh./clearSame behavior as/new./resetClear the live session immediately./resumeList saved sessions for the current chat./resume <name>Restore a saved session by name./title <name>Name the current session./root /absolute/pathChange the working directory for the current chat./model <name>Change the model for the current chat./compactRoll the current conversation into a carry-forward summary and clear the live thread./helpShow the command list.
Repository layout
bridge/Node-based WhatsApp bridgeserver/Python gateway that manages sessions and CLI executionscripts/install.shGuided install flowscripts/pair.shPairing helperscripts/start.shService start helperscripts/stop.shService stop helpersystemd/agent-whatsapp.serviceUser service unit template
Notes
- This project is designed to run as an isolated WhatsApp control layer for coding CLIs.
- It does not need to attach itself to your existing Telegram setup or other local agent workflows.
.envis intentionally not committed.- If you wipe
~/.agent-whatsapp, you also wipe the saved WhatsApp session and will need to pair again.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whatsapp_agent_cli-0.1.0.tar.gz.
File metadata
- Download URL: whatsapp_agent_cli-0.1.0.tar.gz
- Upload date:
- Size: 28.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed55d244869db8313e38e243c13b09c3bfae555baefe3d338625b4e75d32937e
|
|
| MD5 |
d1cb2b31a629906dae1fb0899e523289
|
|
| BLAKE2b-256 |
1c700d08d5a483692f6cbd3d764dd178d3208fd1003aef6ccfcaaf0535c0438d
|
File details
Details for the file whatsapp_agent_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: whatsapp_agent_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d85f4a88c472b5164e367e85be929c696187e221914b7c4fd1e645c5a551ef15
|
|
| MD5 |
1389a05b677fab040c19365ebd652741
|
|
| BLAKE2b-256 |
463e312f80b18f405f3d77496fa6cc3a2325bd39545b527c97b7f923b51ae301
|