openclaw 网盘下载
OpenClaw

技能详情(站内镜像,无评论)

首页 > 技能库 > OpenClaw WhatsApp

WhatsApp bridge for OpenClaw — send/receive messages, auto-reply agents, QR pairing, message search, contact sync

通信与消息

作者:sam1337 @0xs4m1337

许可证:MIT-0

MIT-0 ·免费使用、修改和重新分发。无需归因。

版本:v0.3.0

统计:⭐ 0 · 1.2k · 11 current installs · 13 all-time installs

0

安装量(当前) 13

🛡 VirusTotal :可疑 · OpenClaw :可疑

Package:0xs4m1337/openclaw-whatsapp

安全扫描(ClawHub)

  • VirusTotal :可疑
  • OpenClaw :可疑

OpenClaw 评估

The skill generally matches its stated WhatsApp-bridge purpose, but the runtime instructions ask you to run an external install script (curl | bash) and the included scripts read/use undocumented environment variables and install files under /usr/local/bin/systemd — these inconsistencies and the remote installer are risky.

目的

Name/description describe a local WhatsApp bridge and the files/instructions correspond: a Go binary (openclaw-whatsapp) + two shell relay scripts that enqueue messages and call the local openclaw agent CLI. Requiring the openclaw CLI and a local bridge is coherent with the described functionality.

说明范围

SKILL.md instructs writing scripts into /usr/local/bin, creating a systemd user service, and running a remote install script via curl | bash. The included scripts access local APIs (http://localhost:8555) and pass message history into the openclaw agent (expected), but they also reference environment variables (OC_WA_OPENCLAW_PATH, OC_WA_AGENT_DATA_DIR, OC_WA_SYSTEM_PROMPT, OC_WA_WORKER_PATH) that are not declared in the skill metadata. The sy…

安装机制

There is no formal install spec in registry metadata; instead SKILL.md tells users to run: curl -fsSL https://raw.githubusercontent.com/0xs4m1337/openclaw-whatsapp/main/install.sh | bash. Downloading and piping a remote script to bash is high-risk even when hosted on GitHub raw (the source is traceable but the installer is arbitrary and executed with the user's privileges). The rest of installation requires copying scripts to /usr/local/bin (s…

证书

Declared requirements list no env vars or credentials, but the scripts use several environment variables (OC_WA_OPENCLAW_PATH, OC_WA_AGENT_DATA_DIR, OC_WA_SYSTEM_PROMPT, OC_WA_WORKER_PATH) and expect file-system write access under /usr/local/bin, ~/.openclaw-whatsapp, and ~/.config/systemd/user. No network credentials or external API keys are requested by the skill itself, but the agent/system_prompt can direct the agent to call other integrat…

持久

The skill's recommended installation results in persistent components: a systemd user service and executables under /usr/local/bin, plus persisted queue/log files under $HOME or /tmp. always is false (normal). This persistence is expected for a bridge but combined with the remote installer and sudo file writes increases the risk surface; review the installer and service contents before enabling.

安装(复制给龙虾 AI)

将下方整段复制到龙虾中文库对话中,由龙虾按 SKILL.md 完成安装。

请把本段交给龙虾中文库(龙虾 AI)执行:为本机安装 OpenClaw 技能「OpenClaw WhatsApp」。简介:WhatsApp bridge for OpenClaw — send/receive messages, auto-reply agents, QR pai…。
请 fetch 以下地址读取 SKILL.md 并按文档完成安装:https://raw.githubusercontent.com/openclaw/skills/refs/heads/main/skills/0xs4m1337/openclaw-whatsapp/SKILL.md
(来源:yingzhi8.cn 技能库)

SKILL.md

打开原始 SKILL.md(GitHub raw)

---
name: openclaw-whatsapp
description: WhatsApp bridge for OpenClaw — send/receive messages, auto-reply agents, QR pairing, message search, contact sync
---

# openclaw-whatsapp

WhatsApp bridge that connects OpenClaw agents to WhatsApp. Send messages, auto-reply to DMs with AI, search message history, and sync contacts — all from a single Go binary.

## Quick Reference

```bash
# Check status
openclaw-whatsapp status

# Send a message
openclaw-whatsapp send "NUMBER@s.whatsapp.net" "Your message"

# View logs (if running as service)
journalctl --user -u openclaw-whatsapp.service -f

# View worker logs
tail -f /tmp/openclaw-wa-agent/worker.log
```

## Full Setup (Self-Service)

Follow these steps to set up WhatsApp auto-reply from scratch.

### Step 1: Install the binary

```bash
curl -fsSL https://raw.githubusercontent.com/0xs4m1337/openclaw-whatsapp/main/install.sh | bash
```

Verify installation:
```bash
openclaw-whatsapp version
```

### Step 2: Find your openclaw binary path

```bash
which openclaw
# Example output: /home/USER/.nvm/versions/node/v22.22.0/bin/openclaw
```

Save this path — you'll need it in Step 4.

### Step 3: Install relay scripts

Copy scripts from this skill directory:

```bash
SKILL_DIR="$(dirname "$(realpath "$0")")"  # or use absolute path to skill

# Copy scripts
sudo cp "$SKILL_DIR/scripts/wa-notify.sh" /usr/local/bin/wa-notify.sh
sudo cp "$SKILL_DIR/scripts/wa-notify-worker.sh" /usr/local/bin/wa-notify-worker.sh
sudo chmod +x /usr/local/bin/wa-notify.sh /usr/local/bin/wa-notify-worker.sh
```

Or if running as agent, use the skill directory path directly:
```bash
cp ~/clawd/skills/openclaw-whatsapp/scripts/wa-notify.sh /usr/local/bin/
cp ~/clawd/skills/openclaw-whatsapp/scripts/wa-notify-worker.sh /usr/local/bin/
chmod +x /usr/local/bin/wa-notify.sh /usr/local/bin/wa-notify-worker.sh
```

### Step 4: Configure the worker script

Edit `/usr/local/bin/wa-notify-worker.sh` and update the PATH line with your openclaw binary path from Step 2:

```bash
# Find this line near the top:
export PATH="/home/oussama/.nvm/versions/node/v22.22.0/bin:$PATH"

# Change it to your actual path:
export PATH="/home/YOUR_USER/.nvm/versions/node/vXX.XX.X/bin:$PATH"
```

Also update the worker script path in `/usr/local/bin/wa-notify.sh`:
```bash
# Find this line near the bottom:
nohup /home/oussama/dev/openclaw-whatsapp/scripts/wa-notify-worker.sh

# Change to:
nohup /usr/local/bin/wa-notify-worker.sh
```

### Step 5: Create config file

```bash
mkdir -p ~/.openclaw-whatsapp
cat > ~/.openclaw-whatsapp/config.yaml << 'EOF'
port: 8555
data_dir: ~/.openclaw-whatsapp
auto_reconnect: true
reconnect_interval: 30s
log_level: info

agent:
  enabled: true
  mode: "command"
  command: "/usr/local/bin/wa-notify.sh '{name}' '{message}' '{chat_jid}' '{message_id}'"
  ignore_from_me: true
  dm_only: true
  timeout: 30s
  system_prompt: |
    You are a helpful WhatsApp assistant. Be concise and natural.
EOF
```

### Step 6: Create systemd service (recommended)

```bash
mkdir -p ~/.config/systemd/user

cat > ~/.config/systemd/user/openclaw-whatsapp.service << 'EOF'
[Unit]
Description=OpenClaw WhatsApp Bridge
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/openclaw-whatsapp start -c %h/.openclaw-whatsapp/config.yaml
Restart=always
RestartSec=5

[Install]
WantedBy=default.target
EOF

systemctl --user daemon-reload
systemctl --user enable openclaw-whatsapp.service
systemctl --user start openclaw-whatsapp.service
```

### Step 7: Link WhatsApp

1. Check bridge is running: `openclaw-whatsapp status`
2. Open QR page: `http://localhost:8555/qr`
3. On your phone: WhatsApp → Settings → Linked Devices → Link a Device
4. Scan the QR code

### Step 8: Test

Send a WhatsApp message to the linked number from another phone. Check:
```bash
# Bridge logs
journalctl --user -u openclaw-whatsapp.service -n 20

# Worker logs
cat /tmp/openclaw-wa-agent/worker.log
```

## Architecture

```
WhatsApp DM → Bridge → wa-notify.sh (enqueue)
  → wa-notify-worker.sh (background, file-locked)
  → Fetches last 10 messages for context
  → openclaw agent (processes message)
  → openclaw-whatsapp send <JID> <reply>
  → WhatsApp reply sent
```

Key features:
- **Fast enqueue** — bridge doesn't wait for agent processing
- **Deduplication** — message IDs tracked to prevent double-replies
- **Single worker** — file-locked, sequential processing, no race conditions
- **Crash resilience** — queue persists across restarts

## Customizing System Prompt

Edit `~/.openclaw-whatsapp/config.yaml` and update the `system_prompt` field:

```yaml
agent:
  system_prompt: |
    You are a sales assistant for Acme Corp.
    Be friendly and professional.
    When someone wants to book a demo:
    - Book via: mcporter call composio.GOOGLECALENDAR_CREATE_EVENT ...
    - Notify team via: message action=send channel=telegram target=CHAT_ID ...
```

Restart after changes:
```bash
systemctl --user restart openclaw-whatsapp.service
```

## Allowlist / Blocklist

Restrict which numbers the agent responds to:

```yaml
agent:
  allowlist: ["971586971337"]  # only these (empty = all)
  blocklist: ["spammer123"]     # never these
```

## CLI Reference

```bash
openclaw-whatsapp start [-c config.yaml]  # Start the bridge
openclaw-whatsapp status [--addr URL]      # Check connection status
openclaw-whatsapp send NUMBER MESSAGE      # Send a message
openclaw-whatsapp stop                     # Stop the bridge
openclaw-whatsapp version                  # Print version
```

## Troubleshooting

| Problem | Solution |
|---------|----------|
| QR expired | Refresh http://localhost:8555/qr — auto-refreshes every 3s |
| Bridge disconnected | `openclaw-whatsapp status`; auto-reconnects by default |
| Agent not replying | Check `/tmp/openclaw-wa-agent/worker.log` for errors |
| "stream replaced" errors | Multiple bridge instances — ensure only one runs (`systemctl --user status openclaw-whatsapp` + `pgrep openclaw-whatsapp`) |
| "openclaw: not found" | Edit wa-notify-worker.sh PATH to include openclaw binary |
| "not logged in" | Scan QR again — session expired |

## Files

| Path | Description |
|------|-------------|
| `~/.openclaw-whatsapp/config.yaml` | Bridge configuration |
| `~/.openclaw-whatsapp/messages.db` | SQLite message store |
| `~/.openclaw-whatsapp/sessions/` | WhatsApp session data |
| `/tmp/openclaw-wa-agent/queue.jsonl` | Message queue |
| `/tmp/openclaw-wa-agent/worker.log` | Worker logs |
| `/tmp/openclaw-wa-agent/seen_message_ids.txt` | Deduplication list |

## API Endpoints

| Method | Path | Description |
|--------|------|-------------|
| `GET` | `/status` | Connection status |
| `GET` | `/qr` | QR code page |
| `POST` | `/send/text` | Send message `{"to": "...", "message": "..."}` |
| `GET` | `/chats` | List all chats |
| `GET` | `/chats/{jid}/messages?limit=10` | Messages for a chat |
| `GET` | `/messages/search?q=keyword` | Full-text search |

See [references/api-reference.md](references/api-reference.md) for full API docs.