docs/users/features/channels/wecom.md
This guide covers setting up Qwen Code with a WeCom intelligent robot (企业微信智能机器人).
The intelligent robot uses a WebSocket connection from Qwen Code to WeCom. You do not need a public callback URL, Token, EncodingAESKey, Corp ID, or Agent ID.
Add the channel to ~/.qwen/settings.json:
{
"channels": {
"my-wecom": {
"type": "wecom",
"botId": "$WECOM_BOT_ID",
"secret": "$WECOM_SECRET",
"senderPolicy": "allowlist",
"allowedUsers": ["zhangsan"],
"sessionScope": "user",
"cwd": "/path/to/your/project",
"instructions": "You are a concise coding assistant responding via WeCom.",
"groupPolicy": "open",
"groups": {
"*": { "requireMention": true }
}
}
}
}
Set the credentials as environment variables:
export WECOM_BOT_ID=<your-bot-id>
export WECOM_SECRET=<your-secret>
Or define them in the env section of settings.json:
{
"env": {
"WECOM_BOT_ID": "your-bot-id",
"WECOM_SECRET": "your-secret"
}
}
qwen channel start my-wecom
Open WeCom and send a message to the intelligent robot.
senderPolicy works the same way as other IM channels:
allowlist: only users in allowedUsers can use the bot. This is the recommended enterprise default.pairing: users must pair before using the bot.open: anyone who can message the robot can use it.For groups, set groupPolicy to "allowlist" or "open". By default, group messages require a mention through "requireMention": true.
When the WeCom SDK includes explicit mention metadata, Qwen Code uses it for this gate. If no mention metadata is present, the channel treats delivered group messages as unmentioned. Set "requireMention": false only if you want to rely on WeCom-side delivery scoping instead.
Users can send text, voice messages with transcription, images, mixed text plus images, files, and videos. Images are passed to the agent as image attachments. Files and videos are downloaded to temporary local paths so the agent can read them with file tools.
Assistant responses are sent as WeCom markdown. To send a local image generated by the agent, include one marker outside code blocks:
[IMAGE: /absolute/path/to/image.png]
For safety, local image paths must be inside the channel file directory under the system temporary directory, such as /tmp/channel-files/... on Linux. Generic file, video, and voice upload markers are ignored because model-produced file paths could otherwise upload arbitrary workspace files.
qwen channel start.groupPolicy."requireMention": false.This channel is for WeCom intelligent robots. Self-built application callback credentials such as Corp ID, Agent ID, Token, and EncodingAESKey are not used by this channel.