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"
}
}
}
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". WeCom only delivers group messages that mention the intelligent robot, so every delivered group callback is treated as mentioned. The requireMention setting cannot enable responses to unmentioned group messages because those messages are not delivered to the bot.
Earlier Qwen Code versions also applied the generic requireMention gate after WeCom delivered a group callback. Because the callback does not include separate mention metadata, requireMention: true—including the default value—could reject every delivered group message and make group chat appear nonfunctional.
Qwen Code now relies on WeCom's mention-scoped delivery and does not apply a second mention decision. Existing WeCom configurations containing either requireMention: true or requireMention: false remain valid and do not produce configuration errors. Both values have the same behavior for WeCom, so the field can be removed. Other settings in the same group entry, such as dispatchMode, continue to apply. groupHistoryLimit remains accepted but cannot collect new WeCom history because unmentioned group messages are not delivered.
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.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.