Files
eric b77a8cadb2
Some checks failed
Upstream Sync / Sync latest commits from upstream repo (push) Has been cancelled
'init'
2026-03-24 14:46:41 -05:00

40 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: wechat-chatbot
description: 通过本仓库 web2 的 /chatbot/wechat API 配置微信代理 Chatbot、扫码登录与发消息与 openclaw-wechat 代理协议一致)。
---
# 微信 ChatbotHTTP API
后端基址默认 `http://127.0.0.1:8001`(或 `WEB2_API_BASE`)。若启用 `WEB2_API_TOKEN`,请求需带 `Authorization: Bearer <token>`
## 配置
- 复制 `config/wechat_chatbot.example.json``config/wechat_chatbot.json`,填写 `apiKey``proxyUrl`(由代理服务商提供,与 [openclaw-wechat](https://github.com/freestylefly/openclaw-wechat) 一致)。
- 或通过 API 写入:`POST /chatbot/wechat/config`JSON 字段见示例文件。
## 常用端点
| 方法 | 路径 | 说明 |
|------|------|------|
| GET | `/chatbot/wechat/config` | 查看配置apiKey 脱敏)与本地会话摘要 |
| POST | `/chatbot/wechat/config` | 保存配置 |
| GET | `/chatbot/wechat/proxy/status` | 代理账号状态 |
| POST | `/chatbot/wechat/qr/start` | 获取登录二维码 URL 与 `wId` |
| POST | `/chatbot/wechat/login/check` | Body`{"wId":"..."}`,轮询直至 `logged_in` |
| POST | `/chatbot/wechat/send` | Body`{"targetId":"wxid或群id","text":"..."}` |
| POST | `/chatbot/wechat/webhook/register` | Body`{"webhookUrl":"https://..."}` 供云端收消息 |
## CLI
```bash
python wechat_chatbot_cli.py config-get --json
python wechat_chatbot_cli.py qr-start --json
python wechat_chatbot_cli.py login-check --w-id <wId> --json
python wechat_chatbot_cli.py send --target <wxid> --text "hi" --json
```
## 与 CLI-Anything / Agent 的协作方式
- 优先使用 **`--json`** 或解析 HTTP JSON便于与 [CLI-Anything](https://github.com/HKUDS/CLI-Anything) 类工具链衔接。
- 扫码流程:先 `qr/start` 展示 `qrCodeUrl`,每约 5 秒调用 `login/check` 直至成功或超时。