# wechatbot
**Repository Path**: zaayou/wechatbot
## Basic Information
- **Project Name**: wechatbot
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-05-30
- **Last Updated**: 2026-06-03
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# WeChatBot
WeChat iLink Bot SDK for OpenClaw / AI Agent
Modular, production-grade, multi-language WeChat iLink Bot SDK
---
[δΈζζζ‘£](README.md)
Connect any agent to WeChat in 5 minutes. Inspired by [openclaw-weixin-cli](https://www.npmjs.com/package/@tencent-weixin/openclaw-weixin).
## π¦ SDKs
| SDK | Install | Status |
|-----|---------|--------|
| [Node.js](nodejs/) | `npm install @wechatbot/wechatbot` | β
Production Ready |
| [Python](python/) | `pip install wechatbot-sdk` | β
Production Ready |
| [Go](golang/) | `go get github.com/corespeed-io/wechatbot/golang` | β
Production Ready |
| [Rust](rust/) | `cargo add wechatbot` | β
Production Ready |
## π§ Quick Install (Prebuilt Binaries)
No build tools needed β download and run. Supports **Windows / macOS / Linux**.
**macOS / Linux:**
```bash
curl -fsSL https://raw.githubusercontent.com/corespeed-io/wechatbot/main/install.sh | bash
```
**Windows (PowerShell):**
```powershell
irm https://raw.githubusercontent.com/corespeed-io/wechatbot/main/install.ps1 | iex
```
**Pin a version:**
```bash
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/corespeed-io/wechatbot/main/install.sh | bash -s -- --version v0.1.0
# Windows
install.ps1 -Version v0.1.0
```
Or download directly from [GitHub Releases](https://github.com/corespeed-io/wechatbot/releases).
| Platform | Go Binary | Rust Binary |
|----------|----------|------------|
| Windows x64 | β
`windows-amd64.exe` | β
`rust-windows-amd64.exe` |
| Windows ARM64 | β
`windows-arm64.exe` | π |
| macOS x64 | β
`darwin-amd64` | β
`rust-darwin-amd64` |
| macOS ARM64 | β
`darwin-arm64` | β
`rust-darwin-arm64` |
| Linux x64 | β
`linux-amd64` | β
`rust-linux-amd64` |
| Linux ARM64 | β
`linux-arm64` | β
`rust-linux-arm64` |
## β‘ Quick Start
### Node.js
```typescript
import { WeChatBot } from '@wechatbot/wechatbot'
const bot = new WeChatBot()
await bot.login() // QR code login
bot.onMessage(async (msg) => {
await bot.reply(msg, `Echo: ${msg.text}`) // Auto reply
})
await bot.start()
```
### Python
```python
from wechatbot import WeChatBot
bot = WeChatBot()
@bot.on_message
async def handle(msg):
await bot.reply(msg, f"Echo: {msg.text}")
bot.run() # login + start in one call
```
### Go
```go
bot := wechatbot.New()
bot.Login(ctx, false)
bot.OnMessage(func(msg *wechatbot.IncomingMessage) {
bot.Reply(ctx, msg, fmt.Sprintf("Echo: %s", msg.Text))
})
bot.Run(ctx)
```
### Rust
```rust
let bot = WeChatBot::new(BotOptions::default());
bot.login(false).await?;
bot.on_message(Box::new(|msg| {
println!("{}: {}", msg.user_id, msg.text);
})).await;
bot.run().await?;
```
## π€ Pi Agent Extension
Chat with [Pi coding agent](https://github.com/badlogic/pi-mono) directly from WeChat β scan QR code to connect.
```bash
# Install the extension (recommended)
pi install npm:@wechatbot/pi-agent
# Then in Pi:
/wechat # Show QR code β Scan with WeChat β Connected!
```
See [pi-agent/README.md](pi-agent/README.md) for details.
## β¨ Features
All SDKs share the following capabilities:
| Feature | Description |
|---------|-------------|
| π QR Code Login | Credential persistence, stored in `~/.wechatbot/` |
| π¨ Long Polling | Reliable message receiving with automatic cursor management |
| π¬ Rich Media | Images, files, voice, video (upload + download) |
| π context_token | Automatic lifecycle management, persists across restarts |
| β¨οΈ Typing Status | "Typing..." indicator with ticket caching |
| π CDN Encryption | AES-128-ECB with dual-key format support |
| β»οΈ Session Recovery | Auto re-login on session expiry (`-14`) |
| π Smart Chunking | Split text by natural boundaries (paragraphs β lines β spaces) |
### Node.js Exclusive Features
| Feature | Description |
|---------|-------------|
| π§© Middleware Pipeline | Express/Koa-style composable middleware |
| π¦ Pluggable Storage | File, memory, or custom (Redis, SQLiteβ¦) |
| π― Typed Events | Full IntelliSense lifecycle monitoring |
| π Structured Logging | Leveled, context-aware, pluggable transports |
| ποΈ Message Builder | `.text().image().file().build()` chaining API |
## π Architecture
```mermaid
graph TD
A["π€ Your Bot"] --> B["Bot Client (Orchestrator)"]
B --> C["Poller"]
B --> D["Sender"]
B --> E["Typing"]
B --> F["Media"]
C --> G["Context Store (Token Cache)"]
D --> G
E --> G
F --> G
G --> H["Protocol / API (HTTP Calls)"]
H --> I["Storage (Credentials & State Persistence)"]
```
## π Documentation
| Document | Description |
|----------|-------------|
| [docs/protocol.md](docs/protocol.md) | iLink Bot API Protocol Reference |
| [docs/architecture.md](docs/architecture.md) | Architecture Design & SDK Comparison |
| [nodejs/README.md](nodejs/README.md) | Node.js SDK Documentation |
| [python/README.md](python/README.md) | Python SDK Documentation |
| [golang/README.md](golang/README.md) | Go SDK Documentation |
| [rust/README.md](rust/README.md) | Rust SDK Documentation |
| [pi-agent/README.md](pi-agent/README.md) | Pi Extension (WeChat β Pi Bridge) |
## π Website
The bilingual documentation website has been moved to a separate repository: [jiweiyuan/wechatbot-landing](https://github.com/jiweiyuan/wechatbot-landing)
## π Project Structure
```
wechatbot/
βββ nodejs/ # Node.js SDK (TypeScript)
β βββ src/ # 11 modules
β βββ tests/ # 8 test files
β βββ examples/ # 4 example bots
βββ python/ # Python SDK (async/aiohttp)
β βββ wechatbot/ # 6 modules
β βββ tests/ # 2 test files
βββ golang/ # Go SDK (pure stdlib)
β βββ bot.go # Bot client
β βββ types.go # Type definitions
β βββ internal/ # protocol, auth, crypto
βββ rust/ # Rust SDK
β βββ src/ # 6 modules
βββ pi-agent/ # Pi Extension (WeChat β Pi Bridge)
β βββ src/ # Extension entry & WeChat client
βββ docs/ # Shared documentation
βββ protocol.md # iLink API Protocol Spec
βββ architecture.md # Architecture & SDK Comparison
```
## π License
[MIT](LICENSE)