weixin-channel-setup

Original🇨🇳 Chinese
Translated

Help users quickly configure and use the WeChat channel feature. Use this skill when users want to 'configure WeChat', 'connect to WeChat', 'set up WeChat bot', 'weixin setup', or 'wechat channel'.

7installs
Added on

NPX Install

npx skill4agent add qwenlm/qwen-code-examples weixin-channel-setup

SKILL.md Content (Chinese)

View Translation Comparison →

WeChat Channel Configuration Assistant

This skill helps users quickly configure the WeChat channel feature of Qwen Code, enabling the AI assistant to interact with you via WeChat.

Get Started (3 Steps)

Step 1: Scan QR Code to Log in to WeChat

Run the following command to start the WeChat login process:
bash
qwen channel configure-weixin
Operation Flow:
  1. The terminal will display a QR code URL
  2. Open the URL to view the QR code
  3. Scan the QR code with WeChat and confirm login
  4. Wait for the prompt "Connected to WeChat successfully!"
Saved Information:
  • Token and BaseURL are automatically saved to
    ~/.qwen/channels/weixin/account.json
  • Your WeChat user ID will be automatically recorded for subsequent configuration

Step 2: Add to Configuration File

Edit
~/.qwen/settings.json
to add or update the
channels
configuration:
json
{
  "channels": {
    "my-weixin": {
      "type": "weixin",
      "senderPolicy": "allowlist",
      "allowedUsers": ["YOUR_WEIXIN_USER_ID"],
      "sessionScope": "user",
      "cwd": "/path/to/your/project",
      "instructions": "You are a concise programming assistant, replying via WeChat. Keep answers brief.",
      "model": "qwen3.5-plus"
    }
  }
}
Get Your WeChat User ID:
bash
cat ~/.qwen/channels/weixin/account.json | grep userId
Replace the
userId
value from the output into the
allowedUsers
array in the configuration file.

Step 3: Start the Channel Service

bash
qwen channel start my-weixin
You're successful when you see "[Channel] "my-weixin" is running. Press Ctrl+C to stop."!
Now open WeChat, find your bot assistant, and send a message to test it out.

Configuration Option Explanations

OptionRequiredDescriptionExample
type
Channel type, fixed as
"weixin"
"weixin"
senderPolicy
Access policy:
allowlist
(whitelist),
open
(public),
pairing
(pairing)
"allowlist"
allowedUsers
RecommendedList of allowed WeChat user IDs
["o9cq803zPvc..."]
sessionScope
Session scope:
user
(independent per user),
single
(global shared)
"user"
cwd
RecommendedAI working directory
"/Users/name/project"
instructions
System instructions to control the AI's behavior style"Keep answers brief"
model
Model to use
"qwen3.5-plus"

Common Management Commands

bash
# View currently configured channels
qwen channel --help

# Start WeChat channel
qwen channel start my-weixin

# Check WeChat account status
qwen channel configure-weixin status

# Clear WeChat credentials (use when re-logging in)
qwen channel configure-weixin clear

# Stop the channel (Ctrl+C or kill process)
kill <PID>

Troubleshooting

Issue 1: Failed to Connect After Scanning QR Code

Possible Causes:
  • Timeout due to network issues
  • iLink API is temporarily unavailable
Solutions:
bash
# Re-run the configuration command
qwen channel configure-weixin

Issue 2: No Response When Sending Messages

Checklist:
  • Is the channel service running (
    ps aux | grep "channel start"
    )
  • Is your WeChat user ID in
    allowedUsers
  • Is the
    settings.json
    format correct (JSON syntax)
Debugging Method:
bash
# View detailed logs
DEBUG=1 qwen channel start my-weixin

Issue 3: Want to Switch WeChat Accounts

bash
# Clear old credentials
qwen channel configure-weixin clear

# Re-scan QR code to log in
qwen channel configure-weixin

Advanced Usage

Multi-User Support

Add multiple WeChat user IDs to
allowedUsers
:
json
{
  "channels": {
    "my-weixin": {
      "type": "weixin",
      "senderPolicy": "allowlist",
      "allowedUsers": ["user1@im.wechat", "user2@im.wechat", "user3@im.wechat"]
    }
  }
}

Open Mode (Available to Anyone)

⚠️ Warning: In this mode, anyone can use your bot, please enable it with caution!
json
{
  "channels": {
    "my-weixin": {
      "type": "weixin",
      "senderPolicy": "open"
    }
  }
}

Customize AI Behavior

Define the AI's style via the
instructions
field:
json
{
  "instructions": "You are a professional code review assistant. Answers should be concise and professional, prioritizing solutions followed by explanations."
}

Security Notes

  1. Protect account.json: This file contains your WeChat authentication token, and its permissions are set to
    600
    (only the owner can read and write)
  2. Do not share tokens: Never share the content of
    account.json
    with others
  3. Regularly clean up: When not in use for a long time, run
    configure-weixin clear
    to clear credentials

Next Steps

  • Read the full documentation: See
    docs/users/features/channels/overview.md
  • Learn about Telegram channel: See
    docs/users/features/channels/telegram.md
  • Explore more features: Run
    qwen --help