Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Requirements:
### 1. Clone

```bash
git clone --recurse-submodules https://github.com/bazfer/whatsapp-claude.git
git clone --recurse-submodules https://github.com/Agent-Crafting-Table/whatsapp-claude.git
cd whatsapp-claude
```

Expand All @@ -35,12 +35,39 @@ cp .env.example .env
$EDITOR .env
```

Important defaults:
- `BOT_WORKING_DIR` should point to this repo root
- `WA_DB_PATH` defaults to `vendor/whatsapp-mcp/whatsapp-bridge/store/messages.db` so it matches the bridge storage location
- `WHATSAPP_API_URL` should normally stay `http://127.0.0.1:8080/api`
Key variables:

### 3. Run install
| Variable | Default | Notes |
|---|---|---|
| `BOT_WORKING_DIR` | *(set to repo root)* | `claude -p` picks up `CLAUDE.md` from here |
| `WA_DB_PATH` | `vendor/.../store/messages.db` | Written by the bridge |
| `WHATSAPP_API_URL` | `http://127.0.0.1:8080/api` | Bridge REST API |
| `ALLOWED_CHATS` | *(unset = reply to ALL chats)* | Comma-separated JIDs, e.g. `15551234567@s.whatsapp.net` |
| `POLL_INTERVAL_SECONDS` | `10` | How often to check for new messages |
| `HISTORY_MESSAGES` | `10` | Prior messages included in each Claude prompt |
| `CLAUDE_TIMEOUT_SECONDS` | `60` | Timeout per `claude -p` invocation |

> **Always set `ALLOWED_CHATS` in production.** If unset, the bot will reply to every active chat on the connected WhatsApp account.

### 3. Allow MCP tools in `~/.claude/settings.json`

The poller invokes `claude -p` (non-interactive). Claude Code cannot prompt for permissions in this mode — any tool not pre-allowed will silently fail without sending a reply.

Add the following to the `permissions.allow` array in `~/.claude/settings.json`:

```json
"mcp__whatsapp__send_message",
"mcp__whatsapp__list_messages",
"mcp__whatsapp__list_chats",
"mcp__whatsapp__search_contacts",
"mcp__whatsapp__get_chat",
"mcp__whatsapp__get_contact",
"mcp__whatsapp__get_last_interaction"
```

The repo ships a `.claude/settings.json` with empty hooks. This prevents any global `PreToolUse` hooks (e.g. a Discord typing indicator) from firing inside the WhatsApp bot subprocess.

### 4. Run install

```bash
./install.sh
Expand All @@ -54,7 +81,7 @@ The installer will:
- read configuration from repo-root `.env`
- create and use the bridge submodule `store/` directory for WhatsApp bridge/session data

### 4. Scan QR
### 5. Scan QR

During install, it prints:

Expand All @@ -64,7 +91,7 @@ Scan QR now

When that appears, scan the QR code with WhatsApp on the phone tied to the account.

### 5. Verify services
### 6. Verify services

```bash
systemctl --user status whatsapp-bridge whatsapp-mcp-server whatsapp-poller
Expand All @@ -75,11 +102,13 @@ journalctl --user -u whatsapp-bridge -f

- `install.sh` — Linux server bootstrap
- `poller/poller.py` — Claude polling daemon
- `.claude/settings.json` — disables global hooks for subprocess invocations
- `vendor/whatsapp-mcp` — pinned upstream submodule
- `vendor/whatsapp-mcp/whatsapp-bridge/store/` — runtime WhatsApp bridge data

## Notes

- Services are installed as **user** services, not root services.
- The poller still expects Claude to send replies via MCP `send_message`.
- `BOT_WORKING_DIR` should stay pointed at the repo root so `claude -p` picks up `CLAUDE.md`.
- The poller invokes Claude via `send_message` MCP tool — replies never go through stdout.
- `BOT_WORKING_DIR` must point at the repo root so `claude -p` picks up `CLAUDE.md`.
- WhatsApp typing indicators do not appear in self-chat (sender = receiver on the same account). This is a WhatsApp limitation — indicators work correctly when replying to a different user.
Loading