The Weixin adapter connects EdgeCrab to WeChat (微信) through the iLink Bot API, which provides a POST-based long-polling interface with persistent sync buffer for reliable message ordering across restarts.
An iLink Bot account with API access
A configured bot token from the iLink Bot dashboard
Your WeChat account ID
Variable Required Description WEIXIN_TOKENYes iLink Bot API token WEIXIN_ACCOUNT_IDYes Your WeChat account identifier WEIXIN_BASE_URLNo Custom API base URL (default: iLink Bot API) WEIXIN_CDN_BASE_URLNo CDN endpoint for media upload/download WEIXIN_ALLOWED_USERSNo Comma-separated list of allowed user IDs WEIXIN_DM_POLICYNo DM access policy: open or allowlist WEIXIN_GROUP_POLICYNo Group access policy: open or allowlist
WEIXIN_TOKEN = your-bot-token \
WEIXIN_ACCOUNT_ID=your-account-id \
WeChat User → WeChat Server → iLink Bot API → POST long-poll → EdgeCrab Gateway → Agent
WeChat User ← WeChat Server ← iLink Bot API ←──────────── EdgeCrab Reply
EdgeCrab POST-polls the iLink Bot API with a sync buffer for reliable message ordering
When messages arrive, media items (images, voice, video, files) are downloaded from CDN and decrypted via AES-128-ECB
Messages are dispatched to the agent loop with text and attachment metadata
The agent processes the message and generates a reply
Outbound media is AES-128-ECB encrypted and uploaded to CDN before sending
If the session expires (errcode -14), the adapter auto-recovers without losing state
AES-128-ECB media encryption : Media files are encrypted/decrypted for CDN transport
AES-256-CBC XML encryption : WeCom XML payloads use AES-256-CBC encryption
User allowlist : Set WEIXIN_ALLOWED_USERS to restrict which WeChat users can interact with the bot
Token authentication : All API calls are authenticated with the bot token
Session-expired recovery : Detects errcode -14 and re-authenticates automatically
Text messaging (send and receive)
Image, voice, video, and file attachments (send and receive)
AES-128-ECB encrypted CDN media pipeline (upload + download)
POST-based polling with persistent sync buffer
User allowlist filtering (DM and group policies)
Automatic message deduplication
Session-expired auto-recovery
Context token echo for conversation threading
Markdown reformatting for WeChat’s text-only display
Typing indicator support via ticket-based API
Issue Fix No messages received Verify WEIXIN_TOKEN and WEIXIN_ACCOUNT_ID are correct Unauthorized users Add user IDs to WEIXIN_ALLOWED_USERS Connection timeouts Check network connectivity to iLink Bot API Media download fails Verify WEIXIN_CDN_BASE_URL is reachable Session expired errors Normal — adapter auto-recovers via re-authentication