dsh-wechat
English | 中文
Bridge WeChat contacts to DeepSeek Harness sessions.
Each WeChat contact gets its own DSH session (wechat-<contactId>), so a
conversation with one person keeps its own context. Only senders on the
allowlist are served; unless you configure allowFrom, that is exactly the
WeChat account that completed the QR login.
Transport
The transport is Tencent's official iLink bot channel
(https://ilinkai.weixin.qq.com) through the @tencent-weixin/openclaw-weixin
protocol (MIT, see LICENSE-tencent). The protocol layer is vendored under
src/api, src/cdn, and src/messaging; the OpenClaw runtime glue was
replaced with harness-native equivalents (src/util/logger.ts,
src/storage/state-dir.ts, src/auth/accounts.ts).
Typing indicator
While a bridged turn runs, the contact sees WeChat's native typing indicator:
the bridge fetches a typing ticket (getConfig), sends sendTyping status 1,
refreshes it every 15 seconds for the length of the turn, and cancels it right
before the reply lands. A ticket that cannot be fetched, or any sendTyping
failure, is logged and ignored — the indicator never costs a reply.
Configuration (settings namespace dsh-wechat)
| field | default | meaning |
|---|---|---|
enabled |
true |
master switch for the message loop |
allowFrom |
[] |
WeChat ids allowed to drive the agent; empty means "the linked account only" |
provider / model |
"" |
model route for bridged sessions; empty inherits the harness default |
cwd |
"" |
working directory for bridged sessions; empty uses this package's own directory, so sessions land in the Workspace registered for it |
replyAsSelf |
false |
send replies as the linked account (message_type: USER) so WeChat would draw them on the right; the channel accepted those sends and delivered nothing, so it stays off |
Login: connecting a WeChat account
Login runs on the computer, from this package's directory — WeChat itself only has to scan the code; there is no entry point to open inside WeChat.
1. Install once
cd <package dir>
pnpm install # tsx and the other dev dependencies the login script needs
2. Start the scanning page
pnpm login
It serves a page on this machine at http://127.0.0.1:8899 (refreshed every three
seconds; an expired code is replaced automatically), mirrors the code and its state into
$DSH_HOME/data/dsh-wechat/ (qr-content.txt, login-state.json, qr-login.png), and
waits up to eight minutes for the scan.
3. Scan with the phone
WeChat → Discover → Scan (or “+” → Scan) → scan the code on screen → confirm the binding
on the phone. The command reports scaned, then confirmed, then prints
LOGIN_OK account=<botId> and stores credentials in
$DSH_HOME/data/dsh-wechat/weixin/accounts/<botId>.json.
4. Restart dsh web so the plugin reads the credentials.
5. Start chatting from the account you scanned with. With an empty allowFrom, that
account is the whole allowlist; add other WeChat ids there to let them drive the agent.
| command | purpose |
|---|---|
pnpm login |
scan to log in, or log in again after errcode -14 |
pnpm accounts |
list the accounts stored on this machine |
pnpm listen |
probe-only receive loop; never while the plugin is mounted — one process may long-poll getupdates per bot token |
Credentials stay on the machine that logged in, under $DSH_HOME/data/dsh-wechat/weixin/
(owner-only). This repository contains no account id, contact id, or local path.
Known limitations
- Inbound text, images, and files are bridged — images are fetched from the CDN and attached to the session, files are read into it too. Voice, video, and forwarded cards are skipped with one warning line. Replies are plain text, chunked at 1800 characters.
- Only one process may long-poll
getupdatesper bot token; running the standalone probe while the plugin is mounted splits the message stream. - A WeChat-driven turn cannot answer an approval prompt. Configure the permission and approval policy so bridged sessions do not block on one.
errcode -14means the bot session expired; the plugin stops the loop and a new QR login is required.
License
MIT — see LICENSE. The vendored protocol layer (src/api,
src/cdn, src/messaging) comes from Tencent's openclaw-weixin under its own
MIT license, preserved as LICENSE-tencent together with
UPSTREAM-README.md.
No comments yet. Be the first to write one.