by vicentereig
Danger. Danger. High Voltage. Give your codex/claude access to WhatsApp
# Add to your Claude Code skills
git clone https://github.com/vicentereig/whatsapp-cliFor Humans & LLMs: This document contains comprehensive information about the WhatsApp CLI tool, including installation, usage, API reference, examples, architecture, and troubleshooting. It is designed to be parsed by both humans and large language models.
Version: 1.3.2 Repository: https://github.com/vicentereig/whatsapp-cli License: MIT Language: Go 1.24+
A standalone command-line interface for WhatsApp built on the WhatsApp Web multidevice protocol. Every command returns structured JSON output, making it ideal for:
| Feature | Description | |---------|-------------| | Zero Dependencies | Single compiled binary (21MB), no runtime required | | JSON Output | All commands return structured JSON for easy parsing | | Persistent Sessions | Authenticate once via QR code, auto-reconnect for ~20 days | | Local Storage | SQLite database, no cloud dependencies | | Full Messaging | Send, receive, search messages; manage contacts & chats | | Group Support | Send/receive messages in group chats | | TDD Implementation | 100% test coverage, production-ready |
brew install vicentereig/tap/whatsapp-cli
Or tap first, then install:
brew tap vicentereig/tap
brew install whatsapp-cli
# Linux (x86_64)
curl -LO https://github.com/vicentereig/whatsapp-cli/releases/latest/download/whatsapp-cli-linux-amd64.tar.gz
tar -xzf whatsapp-cli-linux-amd64.tar.gz
sudo mv whatsapp-cli-linux-amd64 /usr/local/bin/whatsapp-cli
# macOS (ARM64 - M1/M2/M3)
curl -LO https://github.com/vicentereig/whatsapp-cli/releases/latest/download/whatsapp-cli-darwin-arm64.tar.gz
tar -xzf whatsapp-cli-darwin-arm64.tar.gz
sudo mv whatsapp-cli-darwin-arm64 /usr/local/bin/whatsapp-cli
# macOS (Intel)
curl -LO https://github.com/vicentereig/whatsapp-cli/releases/latest/download/whatsapp-cli-darwin-amd64.tar.gz
tar -xzf whatsapp-cli-darwin-amd64.tar.gz
sudo mv whatsapp-cli-darwin-amd64 /usr/local/bin/whatsapp-cli
# Windows (x86_64) - download and extract whatsapp-cli-windows-amd64.zip from releases page
# Clone repository
git clone https://github.com/vicentereig/whatsapp-cli.git
cd whatsapp-cli
# Install dependencies
go mod download
# Build
go build -o whatsapp-cli .
# Install (optional)
sudo mv whatsapp-cli /usr/local/bin/
# Verify installation
whatsapp-cli --help
go install github.com/vicentereig/whatsapp-cli@latest
vMAJOR.MINOR.PATCH). Use a specific tag (e.g., v1.0.0) with go install github.com/vicentereig/whatsapp-cli@v1.0.0 for reproducible builds.checksums.txt; run shasum -a 256 -c checksums.txt --ignore-missing to verify before installing.whatsapp-cli-<os>-<arch> (Windows adds .exe). After extraction, mark them executable (chmod +x) and place them somewhere in your PATH such as /usr/local/bin/whatsapp-cli.checksums.txt) also has Sigstore cosign signatures (.sig) and certificates (.pem). To verify, run cosign verify-blob --certificate <file>.pem --signature <file>.sig <file>; GitHub Actions uses OIDC identities, so you can enforce provenance on verification.docs/RELEASE.md for the step-by-step process that drives go install, source builds, and GitHub Release automation.whatsapp-cli auth
What happens:
./store/whatsapp.dbOutput:
{
"success": true,
"data": {
"authenticated": true,
"message": "Successfully authenticated"
},
"error": null
}
Session Duration: ~20 days before re-authentication required
Before you can list or search messages, you need to sync them from WhatsApp:
# Start syncing messages (run this in the background or a separate terminal)
whatsapp-cli sync
# Press Ctrl+C when done syncing
What happens:
./store/messages.dbTip: Run sync in a tmux/screen session or as a background service to continuously receive messages.
# List your chats
whatsapp-cli chats list --limit 10
# Search for a contact
whatsapp-cli contacts search --query "John"
# Send a message
whatsapp-cli send --to 1234567890 --message "Hello from CLI!"
# Search messages
whatsapp-cli messages search --query "meeting"
whatsapp-cli version
Example Output:
{
"success": true,
"data": {
"version": "v1.1.0"
},
"error": null
}
All commands support these global flags:
| Flag | Type | Default | Description |
|------|------|---------|-------------|
| --store | string | ./store | Directory for session and message databases |
Example:
whatsapp-cli --store /var/lib/whatsapp chats list
authAuthenticate with WhatsApp via QR code.
Syntax:
whatsapp-cli auth
Parameters: None
Returns:
{
"success": true,
"data": {
"authenticated": boolean,
"message": string
},
"error": null
}
Behavior:
store/whatsapp.db with session dataExample:
whatsapp-cli auth
# Scan QR code with phone
# ✓ Successfully authenticated!
sync⚠️ IMPORTANT: This command must be run to populate the message database. Without running sync, messages list and messages search will return empty results.
Continuously sync messages from WhatsApp to local database. This command:
Syntax:
whatsapp-cli sync
Parameters: None
Returns: (on exit via Ctrl+C)
{
"success": true,
"data": {
"synced": true,
"messages_count": 1234
},
"error": null
}
Behavior:
*events.Message for real-time messages*events.HistorySync for message history batchesstore/messages.dbProgress Output (stderr):
🚀 Starting WhatsApp sync...
✓ Connected to WhatsApp
🔄 Listening for messages... (Press Ctrl+C to stop)
📜 Processing history sync (42 conversations)...
💬 Synced 1234 messages...
^C
✓ Sync completed. Total messages synced: 1234
Examples:
# Basic sync - run in foreground
whatsapp-cli sync
# Run in background (recommended for continuous syncing)
whatsapp-cli sync > sync.json 2> sync.log &
# Run in tmux/screen session
tmux new -s whatsapp
whatsapp-cli sync
# Detach with Ctrl+B D
# Run with custom storage directory
whatsapp-cli --store /var/lib/whatsapp sync
# Stop sync gracefully
kill -INT <pid>
# Or press Ctrl+C in foreground
Use Cases:
Notes:
No comments yet. Be the first to share your thoughts!