WeChat Integration
Bring OpenClaw to WeChat's 1.3 Billion Users
WeChat is not just a messaging app - it is the super-app that defines digital life in China. From messaging to payments, shopping to services, WeChat is where business happens. OpenClaw integrates with WeChat's Official Account Platform, Mini Programs, and Work WeChat to deliver AI-powered experiences to the world's largest messaging ecosystem.
Setup Guide
Register WeChat Official Account
Create an Official Account through the WeChat admin platform. Service Accounts are best for businesses (more features, verified badge). Subscription Accounts work for content creators. Verification requires business registration documents.
# WeChat Official Account Types:
# 1. Subscription Account (订阅号)
# - For media and individuals
# - Messages appear in subscription folder
# - Limited API access
# - Easier registration
# 2. Service Account (服务号)
# - For businesses and organizations
# - Messages appear in main chat list
# - Full API access
# - Requires business verification
# - Push 4 messages/month to all followers
# Registration: https://mp.weixin.qq.com
# Required documents:
# - Business license
# - Administrator ID
# - Bank account for verification Enable Developer Mode
Configure developer settings in your Official Account admin panel. This enables programmatic access to receive and respond to messages. You'll configure a server URL that WeChat will call when messages arrive.
# In WeChat Admin Panel:
# 设置与开发 (Settings & Dev) > 基本配置 (Basic Config)
# Configure:
# 1. 服务器地址 (Server URL): https://yourdomain.com/wechat/webhook
# 2. 令牌 (Token): YOUR_VERIFICATION_TOKEN
# 3. 消息加解密密钥 (EncodingAESKey): Auto-generated 43-char key
# 4. 消息加解密方式: 安全模式 (Encrypted mode - recommended)
# Save AppID and AppSecret:
# AppID: wx1234567890abcdef
# AppSecret: Your secret key (keep secure!)
# WeChat will send a verification request
# Your server must respond correctly to activate Install WeChat Bridge Module
Add the WeChat bridge to your OpenClaw installation. The bridge handles WeChat's unique XML message format, signature verification, and access token management.
# Using OpenClaw CLI
openclaw install wechat-bridge
# Or manual installation
cd /path/to/openclaw
npm install @openclaw/wechat-bridge
# This installs wechat-api packages
npm install co-wechat co-wechat-api
# Verify installation
openclaw plugins list | grep wechat Configure WeChat Connection
Create your WeChat configuration file with Official Account credentials and message handling settings. Configure encryption mode and response behavior.
# config/wechat.yaml
wechat:
enabled: true
# Official Account credentials
app_id: "YOUR_APP_ID"
app_secret: "YOUR_APP_SECRET"
token: "YOUR_VERIFICATION_TOKEN"
encoding_aes_key: "YOUR_ENCODING_AES_KEY"
# Webhook settings
webhook:
path: "/wechat/webhook"
port: 443 # Must be 80 or 443
# Message handling
messages:
encrypt_mode: "aes" # plain, compatible, aes
auto_reply: true
typing_simulation: false # WeChat doesn't support typing indicators
# Access token management
token_cache:
enabled: true
storage: "redis" # or 'memory', 'file'
redis_url: "redis://localhost:6379" Implement Verification Handler
WeChat verifies your server by sending a GET request with signature, timestamp, nonce, and echostr. Your server must verify the signature and return the echostr to prove authenticity.
# OpenClaw handles this automatically, but here's the logic:
# Verification request parameters:
# - signature: SHA1(sorted(token, timestamp, nonce))
# - timestamp: Unix timestamp
# - nonce: Random string
# - echostr: Random string to return
# Verification process:
# 1. Sort [token, timestamp, nonce] alphabetically
# 2. Concatenate sorted values
# 3. SHA1 hash the concatenation
# 4. Compare with signature
# 5. If match, return echostr
# Test verification:
openclaw wechat verify-test
# Once verified, WeChat shows "配置成功" (Config Successful) Configure Custom Menu
Create the persistent menu that appears at the bottom of your Official Account chat. Menus can trigger messages, open URLs, or launch Mini Programs.
# config/wechat-menu.yaml
menu:
buttons:
# First column
- type: click
name: "Ask AI"
key: "AI_QUERY"
# Second column with submenu
- name: "Services"
sub_buttons:
- type: click
name: "Customer Service"
key: "CUSTOMER_SERVICE"
- type: click
name: "FAQ"
key: "FAQ"
- type: view
name: "Website"
url: "https://yourwebsite.com"
# Third column
- type: miniprogram
name: "Mini App"
appid: "YOUR_MINIPROGRAM_APPID"
pagepath: "pages/index/index"
url: "https://fallback.url" # For old clients
# Deploy menu:
openclaw wechat menu deploy Configure AI Response Behavior
Set up how OpenClaw processes WeChat messages and formats responses. Handle different message types and configure WeChat-specific features.
# config/wechat-ai.yaml
ai_responses:
# Response time limit (WeChat requires response within 5 seconds)
timeout_seconds: 4
async_mode: true # Use customer service API for slow responses
# Message type handlers
handlers:
text: ai_response
voice: transcribe_and_respond
image: analyze_and_respond
video: describe_and_respond
location: contextual_response
link: summarize_and_respond
# Response formatting
format:
max_length: 600 # WeChat text message limit
split_long_messages: true
use_news_for_long: true # Convert long responses to news articles
# Event handlers
events:
subscribe: welcome_message
unsubscribe: log_only
scan: handle_qr_scan
location: update_user_location
click: handle_menu_click
view: log_url_click Test and Deploy
Test your WeChat bot functionality and verify all message types work correctly. Use WeChat's sandbox environment for development before going live.
# Use WeChat Sandbox for development:
# https://mp.weixin.qq.com/debug/cgi-bin/sandbox
# Start OpenClaw WeChat bridge
openclaw wechat start
# Check status
openclaw wechat status
# View logs
openclaw logs wechat --follow
# Test with WeChat:
# 1. Scan QR code to follow your test account
# 2. Send a message
# 3. Verify AI response
# Monitor access token
openclaw wechat token status What You Can Do
Customer Service in China
Provide 24/7 customer support to Chinese customers through WeChat. Answer product questions, handle complaints, process orders, and escalate to human agents. Essential for any business targeting the Chinese market.
E-commerce Assistant
Guide users through product discovery, answer questions, provide recommendations, and facilitate purchases with WeChat Pay integration. Create seamless conversational commerce experiences.
Travel and Tourism
Assist Chinese tourists with travel information, booking help, translation services, and local recommendations. Hotels, airlines, and attractions use WeChat bots to serve the Chinese travel market.
Healthcare Information
Provide health information, appointment scheduling, and patient support through WeChat. Chinese healthcare providers use Official Accounts for patient communication and health management.
Education and Learning
Deliver educational content, answer student questions, provide tutoring assistance, and manage course communications. Schools and EdTech companies leverage WeChat for student engagement.
Enterprise Communication
Deploy AI assistance in Work WeChat for internal enterprise use. Automate HR queries, IT support, and business processes. Connect to corporate systems for intelligent workplace assistance.
Financial Services
Provide account information, transaction assistance, and financial advice through WeChat. Banks and fintech companies use Official Accounts for customer engagement.
Government Services
Many Chinese government agencies offer services through WeChat. Provide citizens with information, process requests, and deliver public services through AI-assisted conversations.
Brand Engagement
Build brand presence and engage followers with interactive AI experiences. Run campaigns, distribute content, and create memorable interactions that strengthen brand loyalty.
Known Limitations
- Account verification requires Chinese business registration or approved foreign business documentation
- Service Accounts can only push 4 messages per month to all followers (but unlimited replies)
- Response time limit: WeChat requires initial response within 5 seconds
- Text messages limited to 600 characters (2048 for customer service messages)
- WeChat Mini Programs require separate development and approval process
- API access varies by account type - full features require verified Service Account
- Content subject to Chinese regulations and WeChat policies
- Some AI capabilities may face additional regulatory considerations in China
- Cross-border data transfer considerations for non-Chinese businesses
- Payment integration (WeChat Pay) requires separate merchant registration
- Our team can help you work around these limitations with custom configurations
Related Content
Bring OpenClaw AI Power to Your Discord Server
Deploy OpenClaw as a Discord bot for your server. Automate moderation, answer questions, manage communities, run games, and provide AI assistance to all your members with slash commands and rich embeds.
Supercharge Your Gmail with OpenClaw AI
Connect OpenClaw to Gmail for intelligent email management. Automatically summarize messages, draft responses, organize your inbox, and manage emails through natural language commands.
Connect OpenClaw to LINE Messenger
Deploy OpenClaw on LINE messenger to reach 200 million users across Japan, Taiwan, Thailand, and Indonesia. Build powerful AI chatbots with rich messaging, LIFF apps, and LINE ecosystem integration.
OpenClaw on Matrix: Decentralized AI for a Decentralized World
Deploy OpenClaw on the Matrix protocol for a truly decentralized AI assistant. Self-host everything, federate with others, and maintain complete sovereignty over your AI interactions.