feat: Add full WhatsApp Business Cloud API integration
- Add WhatsApp channel module with Cloud API v18.0 support - Implement webhook-based message reception and API sending - Add allowlist for phone numbers (E.164 format or wildcard) - Add WhatsApp webhook endpoints to gateway (/whatsapp GET/POST) - Add WhatsApp config schema with TOML support - Wire WhatsApp into channel factory, CLI, and doctor commands - Add WhatsApp to setup wizard with connection testing - Add comprehensive test coverage (47 channel tests + 9 URL decoding tests) - Update README with detailed WhatsApp setup instructions - Support text messages only, skip media/status updates - Normalize phone numbers with + prefix - Handle webhook verification with Meta challenge-response All 756 tests pass. Ready for production use.
This commit is contained in:
parent
ec2d5cc93d
commit
cc08f4bfff
6 changed files with 1749 additions and 5 deletions
45
README.md
45
README.md
|
|
@ -94,6 +94,10 @@ zeroclaw integrations info Telegram
|
|||
# Manage background service
|
||||
zeroclaw service install
|
||||
zeroclaw service status
|
||||
|
||||
# Migrate memory from OpenClaw (safe preview first)
|
||||
zeroclaw migrate openclaw --dry-run
|
||||
zeroclaw migrate openclaw
|
||||
```
|
||||
|
||||
> **Dev fallback (no global install):** prefix commands with `cargo run --release --` (example: `cargo run --release -- status`).
|
||||
|
|
@ -109,7 +113,7 @@ Every subsystem is a **trait** — swap implementations with a config change, ze
|
|||
| Subsystem | Trait | Ships with | Extend |
|
||||
|-----------|-------|------------|--------|
|
||||
| **AI Models** | `Provider` | 22+ providers (OpenRouter, Anthropic, OpenAI, Ollama, Venice, Groq, Mistral, xAI, DeepSeek, Together, Fireworks, Perplexity, Cohere, Bedrock, etc.) | `custom:https://your-api.com` — any OpenAI-compatible API |
|
||||
| **Channels** | `Channel` | CLI, Telegram, Discord, Slack, iMessage, Matrix, Webhook | Any messaging API |
|
||||
| **Channels** | `Channel` | CLI, Telegram, Discord, Slack, iMessage, Matrix, WhatsApp, Webhook | Any messaging API |
|
||||
| **Memory** | `Memory` | SQLite with hybrid search (FTS5 + vector cosine similarity), Markdown | Any persistence backend |
|
||||
| **Tools** | `Tool` | shell, file_read, file_write, memory_store, memory_recall, memory_forget, browser_open (Brave + allowlist), composio (optional) | Any capability |
|
||||
| **Observability** | `Observer` | Noop, Log, Multi | Prometheus, OTel |
|
||||
|
|
@ -197,6 +201,43 @@ rerun channel setup only:
|
|||
zeroclaw onboard --channels-only
|
||||
```
|
||||
|
||||
### WhatsApp Business Cloud API Setup
|
||||
|
||||
WhatsApp uses Meta's Cloud API with webhooks (push-based, not polling):
|
||||
|
||||
1. **Create a Meta Business App:**
|
||||
- Go to [developers.facebook.com](https://developers.facebook.com)
|
||||
- Create a new app → Select "Business" type
|
||||
- Add the "WhatsApp" product
|
||||
|
||||
2. **Get your credentials:**
|
||||
- **Access Token:** From WhatsApp → API Setup → Generate token (or create a System User for permanent tokens)
|
||||
- **Phone Number ID:** From WhatsApp → API Setup → Phone number ID
|
||||
- **Verify Token:** You define this (any random string) — Meta will send it back during webhook verification
|
||||
|
||||
3. **Configure ZeroClaw:**
|
||||
```toml
|
||||
[channels_config.whatsapp]
|
||||
access_token = "EAABx..."
|
||||
phone_number_id = "123456789012345"
|
||||
verify_token = "my-secret-verify-token"
|
||||
allowed_numbers = ["+1234567890"] # E.164 format, or ["*"] for all
|
||||
```
|
||||
|
||||
4. **Start the gateway with a tunnel:**
|
||||
```bash
|
||||
zeroclaw gateway --port 8080
|
||||
```
|
||||
WhatsApp requires HTTPS, so use a tunnel (ngrok, Cloudflare, Tailscale Funnel).
|
||||
|
||||
5. **Configure Meta webhook:**
|
||||
- In Meta Developer Console → WhatsApp → Configuration → Webhook
|
||||
- **Callback URL:** `https://your-tunnel-url/whatsapp`
|
||||
- **Verify Token:** Same as your `verify_token` in config
|
||||
- Subscribe to `messages` field
|
||||
|
||||
6. **Test:** Send a message to your WhatsApp Business number — ZeroClaw will respond via the LLM.
|
||||
|
||||
## Configuration
|
||||
|
||||
Config: `~/.zeroclaw/config.toml` (created by `onboard`)
|
||||
|
|
@ -252,6 +293,8 @@ enabled = false # opt-in: 1000+ OAuth apps via composio.dev
|
|||
| `/health` | GET | None | Health check (always public, no secrets leaked) |
|
||||
| `/pair` | POST | `X-Pairing-Code` header | Exchange one-time code for bearer token |
|
||||
| `/webhook` | POST | `Authorization: Bearer <token>` | Send message: `{"message": "your prompt"}` |
|
||||
| `/whatsapp` | GET | Query params | Meta webhook verification (hub.mode, hub.verify_token, hub.challenge) |
|
||||
| `/whatsapp` | POST | None (Meta signature) | WhatsApp incoming message webhook |
|
||||
|
||||
## Commands
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue