Introduction¶
The DeepSeek Harness (DSH) ecosystem is plugin-centric. If you need to integrate WeChat messages in DSH, the official ClawBot (iLink) protocol is the standard approach. Existing integrations often rely on SDKs or require manually handling complex token persistence logic. This section introduces yauntyour/dsh-wx-msg-tool, which encapsulates the full workflow of QR-code login, token management, and message sending/receiving, allowing DSH to send and receive WeChat messages directly over HTTP/JSON.
Plugin Overview¶
A DSH plugin based on Tencent’s official WeChat ClawBot (iLink) API. It provides QR-code login through the settings page, automatically saves the login state to a local file, and offers four tools: wx_login, wx_send, wx_poll, and wx_status, supporting automatic background long polling and automatic conversation replies.
Core Features¶
QR-Code Login in Settings and Token Management¶
On the DSH Web settings page, find the “WeChat Messages” page and click “QR-Code Login”. The plugin draws the QR code locally in the browser. After confirming on your phone, the api-token is automatically saved to <DSH_HOME>/plugins/wx-msg-tool/state.json (stored on the local machine only; the browser cannot access it). The plugin includes a built-in HTTP channel for host communication, bypassing the official settings page restrictions on third-party plugins.
Toolset¶
The plugin provides four core tools, invokable through the DSH CLI or API:
wx_login: initiate QR-code login (qrcodesubcommand), query login state (status), and log out and clear the token (logout).wx_send: send a text message. Thetoandcontext_tokenparameters must be obtained from the message returned bywx_pollto associate the conversation.wx_poll: receive messages. When automatic polling is disabled in the settings page, this tool can connect directly to the server for long polling; when enabled, it reads the inbox monitored in the background.wx_status: query channel status, including login state, token existence, monitoring status, and inbox message count.
Automatic Background Long Polling¶
After enabling automatic polling in the settings page, the DSH host process continuously long-polls the WeChat server and temporarily stores messages in the inbox.jsonl file for later reading. If a session expiration is encountered (errcode -14), polling stops automatically and prompts the user to log in again.
Automatic Conversation Replies¶
After enabling “Automatically trigger a DSH conversation reply when a message is received” in the settings page, each WeChat message drives a real DSH conversation round. The system maintains a persistent session for each user (recorded in chats.json and recoverable after restart), completes a round with the default model, and automatically sends the reply back to WeChat. Note that this feature consumes model invocations.
Headless Compatibility¶
The plugin supports Headless mode. After logging in on the Web side, the token has already been written to disk and can be reused directly by a Headless profile. Alternatively, override the configuration via the environment variables WX_MSG_API_TOKEN, WX_MSG_BASE_URL, and WX_MSG_AUTO_POLL=1.
Installation and Activation¶
1. Build and Install¶
First, enter the plugin directory, then build and package the plugin:
cd DSH-WX-Msg-Tool
npm install --ignore-scripts
npm run build
npm pack
After the build is complete, mount the generated .tgz file to the DSH Web profile:
dsh plugin --profile web add "D:/Developments/Workspace/DSH-WX-Msg-Tool/deepseek-ai-dsh-wx-msg-tool-1.1.0.tgz"
2. Restart the Service¶
After mounting the plugin, restart the dsh web command to make the configuration take effect.
Typical Usage¶
Login and Status Check¶
# 发起扫码登录
wx_login qrcode
# 查询当前登录状态
wx_status
Message Sending and Receiving¶
# 收取消息
wx_poll
# 发送文本消息(需配合 wx_poll 返回的上下文)
wx_send text="Hello" to="user_id"
Notes¶
- Protocol and risks: Based on the HTTP/JSON protocol, with no SDK dependency, no hooks, and no account-banning risk. Before use, please read and comply with the “WeChat ClawBot Feature Terms of Use”.
- Conversation restrictions: Due to iLink protocol limitations, the bot cannot send the first message to a user without an existing conversation (the other party must send a message first).
- Resource consumption: Automatic conversation replies consume model invocations.
- Error handling: When a session expires (errcode -14), polling stops automatically and prompts the user to log in again.
Conclusion¶
This plugin provides stable WeChat integration through the official API, making it suitable for scenarios that require building WeChat automation or customer service bots in DSH. Source code and catalog page links are provided below.