This skill helps users quickly configure the WeChat channel feature of Qwen Code, allowing the AI assistant to interact with you through WeChat.
Quick Start (Complete in 3 Steps)
Step 1: Scan the QR Code to Log In to WeChat
Run the following command to start the WeChat login process:
qwen channel configure-weixin
Procedure:
- The terminal will display a QR code URL
- Open that URL to view the QR code
- Use WeChat to scan the code and confirm the login
- Wait for the prompt "Connected to WeChat successfully!"
Saved information:
- The Token and BaseURL are automatically saved to
~/.qwen/channels/weixin/account.json - Your WeChat ID will be automatically recorded and will be needed for subsequent configuration
Step 2: Add to the Configuration File
Edit ~/.qwen/settings.json, add or update the channels configuration:
{
"channels": {
"my-weixin": {
"type": "weixin",
"senderPolicy": "allowlist",
"allowedUsers": ["YOUR_WEIXIN_USER_ID"],
"sessionScope": "user",
"cwd": "/path/to/your/project",
"instructions": "你是一个简洁的编程助手,通过微信回复。保持回答简短。",
"model": "qwen3.5-plus"
}
}
}
Get your WeChat ID:
cat ~/.qwen/channels/weixin/account.json | grep userId
Replace the userId value in the output with the allowedUsers array in the configuration file.
Step 3: Start the Channel Service
qwen channel start my-weixin
Seeing "[Channel] "my-weixin" is running. Press Ctrl+C to stop." means success!
Now open WeChat, find your bot assistant, and send a message to test it.
Configuration Options
| Option | Required | Description | Example |
|---|---|---|---|
type |
✅ | Channel type, fixed as "weixin" |
"weixin" |
senderPolicy |
❌ | Access policy:allowlist(whitelist),open(public),pairing(pairing) |
"allowlist" |
allowedUsers |
Recommended | List of WeChat user IDs allowed to use | ["o9cq803zPvc..."] |
sessionScope |
❌ | Session scope:user(per-user independent),single(globally shared) |
"user" |
cwd |
Recommended | AI working directory | "/Users/name/project" |
instructions |
❌ | System instructions, controlling the AI's behavior style | "Keep answers brief" |
model |
❌ | Model to use | "qwen3.5-plus" |
Common Management Commands
# 查看当前配置的通道
qwen channel --help
# 启动微信通道
qwen channel start my-weixin
# 查看微信账号状态
qwen channel configure-weixin status
# 清除微信凭证(重新登录时使用)
qwen channel configure-weixin clear
# 停止通道(Ctrl+C 或 kill 进程)
kill <PID>
Troubleshooting
Issue 1: Unable to connect after scanning the QR code
Possible causes:
- Network issues causing a timeout
- The iLink API is temporarily unavailable
Solutions:
# 重新运行配置命令
qwen channel configure-weixin
Issue 2: No response when sending messages
Checklist:
- Whether the channel service is running (
ps aux | grep "channel start") - Whether your WeChat ID is in
allowedUsersWhether your WeChat ID is in allowedUsers -
settings.jsonWhether the format is correct (JSON syntax)
Debugging methods:
# 查看详细日志
DEBUG=1 qwen channel start my-weixin
Issue 3: Want to change the WeChat account
# 清除旧凭证
qwen channel configure-weixin clear
# 重新扫码登录
qwen channel configure-weixin
Advanced Usage
Multi-user support
Add multiple WeChat users in allowedUsers Add multiple WeChat users in allowedUsers:
{
"channels": {
"my-weixin": {
"type": "weixin",
"senderPolicy": "allowlist",
"allowedUsers": ["user1@im.wechat", "user2@im.wechat", "user3@im.wechat"]
}
}
}
Open mode (anyone can use)
⚠️ Warning: In this mode, anyone can use your bot, so enable it with caution!
{
"channels": {
"my-weixin": {
"type": "weixin",
"senderPolicy": "open"
}
}
}
Customize AI behavior
Define the AI's style through the instructions field:
{
"instructions": "你是一个专业的代码审查助手。回答要简洁专业,优先给出解决方案,然后解释原因。"
}
Security Notes
- Protect account.json: This file contains your WeChat authentication token, and its permissions have been set to
600(readable and writable by owner only) - Do not share the token: Never share the
account.jsoncontent with others - Clean up regularly: When not in use for a long time, run
configure-weixin clearto clear credentials
Next step
- Read the full documentation: see
docs/users/features/channels/overview.md - Learn about the Telegram channel: see
docs/users/features/channels/telegram.md - Explore more features: run
qwen --help