WeChat channel plugin for OpenClaw (Python port of @tencent-weixin/openclaw-weixin)
Project description
wechat-clawbot
Python SDK for the WeChat ClawBot ilink API, with a built-in Claude Code Channel bridge.
Ported from @tencent-weixin/openclaw-weixin (TypeScript).
WeChat (iOS) --> ClawBot --> ilink API --> [wechat-clawbot] --> Claude Code Session
|
Claude Code <-- MCP Channel Protocol <-- wechat_reply tool
Features
- Full ilink API client — getUpdates long-poll, sendMessage, getConfig, sendTyping
- Multi-account support — QR code login, credential storage, account index
- Media pipeline — AES-128-ECB encrypted CDN upload/download, image/video/file/voice
- SILK transcoding — voice message to WAV conversion (optional)
- Message processing — inbound conversion, slash commands, debug mode, error notices
- Claude Code Channel — MCP server bridging WeChat messages into Claude Code sessions
- Async-first — built on httpx + asyncio with shared connection pools
Requirements
- Python 3.10+
- uv (recommended) or pip
Installation
uv add wechat-clawbot
Or with pip:
pip install wechat-clawbot
Optional extras:
uv add "wechat-clawbot[silk]" # SILK voice transcoding
uv add "wechat-clawbot[socks]" # SOCKS proxy support (e.g. behind a SOCKS5 proxy)
Quick Start — Claude Code Channel
1. Login with WeChat QR code
wechat-clawbot-cc setup
Scan the terminal QR code with WeChat. Credentials are saved to ~/.claude/channels/wechat/account.json.
2. Register the MCP server
claude mcp add wechat -- wechat-clawbot-cc serve
3. Start Claude Code with the WeChat channel
claude --channels server:wechat
Send a message in WeChat ClawBot, and Claude will reply.
Quick Start — Python SDK
import asyncio
from wechat_clawbot.api.client import WeixinApiOptions, get_updates, send_message
from wechat_clawbot.api.types import (
MessageType, MessageState, MessageItemType,
SendMessageReq, WeixinMessage, MessageItem, TextItem,
)
async def main():
opts = WeixinApiOptions(base_url="https://ilinkai.weixin.qq.com", token="your-bot-token")
# Long-poll for messages
resp = await get_updates(base_url=opts.base_url, token=opts.token)
for msg in resp.msgs or []:
print(f"From: {msg.from_user_id}, Text: {msg.item_list}")
# Send a reply
await send_message(opts, SendMessageReq(msg=WeixinMessage(
to_user_id="user@im.wechat",
client_id="my-client-id",
message_type=MessageType.BOT,
message_state=MessageState.FINISH,
item_list=[MessageItem(type=MessageItemType.TEXT, text_item=TextItem(text="Hello!"))],
context_token="token-from-getupdates",
)))
asyncio.run(main())
Project Structure
src/wechat_clawbot/
api/ # ilink HTTP API client and protocol types
auth/ # QR login, account storage, pairing
cdn/ # AES-128-ECB crypto, CDN upload/download
config/ # Pydantic configuration schema
media/ # Media download, MIME types, SILK transcoding
messaging/ # Inbound conversion, send, slash commands, process pipeline
monitor/ # Long-poll monitor loop
storage/ # State directory, sync buffer persistence
util/ # Logger, ID generation, redaction
claude_channel/ # Claude Code MCP Channel bridge (CLI + server)
Development
git clone https://github.com/anthropics/wechat-clawbot.git
cd wechat-clawbot
uv sync
# Run tests
uv run pytest tests/ -v
# Lint
uv run ruff check src/ tests/
# Format
uv run ruff format src/ tests/
API Documentation
See docs/api.md for the full public API reference.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wechat_clawbot-0.1.0.tar.gz.
File metadata
- Download URL: wechat_clawbot-0.1.0.tar.gz
- Upload date:
- Size: 36.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b4542e63b662c52634822eca8d3c451e17989231c6fc3b75cca46d442d7aa97
|
|
| MD5 |
9a92598b6ab63dd26acc74465e616082
|
|
| BLAKE2b-256 |
298862f72d422fd96732c56a2a1e9eca2a0ccbf6a8c5e334890612a25b453328
|
Provenance
The following attestation bundles were made for wechat_clawbot-0.1.0.tar.gz:
Publisher:
publish.yml on nightsailer/wechat-clawbot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wechat_clawbot-0.1.0.tar.gz -
Subject digest:
7b4542e63b662c52634822eca8d3c451e17989231c6fc3b75cca46d442d7aa97 - Sigstore transparency entry: 1155097736
- Sigstore integration time:
-
Permalink:
nightsailer/wechat-clawbot@0d142c71f2da948768fa7c33f3daa045abee4dcf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nightsailer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0d142c71f2da948768fa7c33f3daa045abee4dcf -
Trigger Event:
release
-
Statement type:
File details
Details for the file wechat_clawbot-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wechat_clawbot-0.1.0-py3-none-any.whl
- Upload date:
- Size: 53.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dc2a9db4109e019ccb281487c9dbe9ad4272867a6d4cda679f5d2e90b95a0a4
|
|
| MD5 |
d6120b5dc38a367dec080ae9f0245809
|
|
| BLAKE2b-256 |
9a312308f96a0e10d6560793f3bba73511988afc3b9a78377a626af90e49c28f
|
Provenance
The following attestation bundles were made for wechat_clawbot-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on nightsailer/wechat-clawbot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wechat_clawbot-0.1.0-py3-none-any.whl -
Subject digest:
8dc2a9db4109e019ccb281487c9dbe9ad4272867a6d4cda679f5d2e90b95a0a4 - Sigstore transparency entry: 1155097738
- Sigstore integration time:
-
Permalink:
nightsailer/wechat-clawbot@0d142c71f2da948768fa7c33f3daa045abee4dcf -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nightsailer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0d142c71f2da948768fa7c33f3daa045abee4dcf -
Trigger Event:
release
-
Statement type: