sam1337

OpenClaw WhatsApp

AI 智能体v0.3.0
作者:sam1337更新于 2026-05-18openclaw-whatsapp@clawhub_0xs4m1337/openclaw-whatsapp
任务自动化工具调用#WhatsApp#Message#Sync

据 AlphaMoat 统计,截至 2026-09,OpenClaw WhatsApp 累计下载 4,858 次、获 1 个星标,在全部 5,078 个 AI 技能中排名第 1,932 位,在「AI 智能体」分类(969 个)中排名第 365 位。

累计安装
149
累计下载
4,858
星标
1
全站排名
#1,932
全站前 39% · 「AI 智能体」前 38%
平台累计安装累计下载星标评论
ClawHub ↗1494,7611-
SkillHub ↗1484,8581—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

此技能以单个 Go 程序提供桥接,并说明配对、状态检查和日志查看。消息、联系人及会话历史都可能包含敏感信息;发送消息、启用自动回复或同步联系人前,应确认账号、接收对象和授权范围。 设置会下载远程代码并可能持续运行代理;应验证安装程序、限制自动回复,并保护队列和日志。

资料发布于 2026-10-29

可以用来做什么

  • 查看 WhatsApp 桥接的运行状态和日志

什么时候用

  • 需要从 OpenClaw 管理 WhatsApp 消息或联系人时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

概括此桥接支持的通信功能,并说明启用自动回复或发送消息前需要确认什么。

月度数据趋势

累计下载4,858
2,2513,6515,0512026-03 · 累计下载 2,4442026-05 · 累计下载 3,9062026-07 · 累计下载 4,4162026-08 · 累计下载 4,6342026-09 · 累计下载 4,85826-0326-09
星标1
0112026-03 · 星标 -2026-05 · 星标 -2026-07 · 星标 12026-08 · 星标 12026-09 · 星标 126-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-094,858—1
2026-084,634+4.9%1
2026-074,416—1
2026-053,906—-
2026-032,444—-

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

6.9 KB · ClawHub v0.3.0
---
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
展开全部(共 247 行)

```bash
# Check status
openclaw-whatsapp status

# Send a message
openclaw-whatsapp send "[email protected]" "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.

「AI 智能体」分类下的热门技能

sam1337 的其他技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。