npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zhin.js/adapter-weixin-ilink

v3.0.0

Published

Zhin.js adapter for WeChat personal account via Tencent iLink Endpoint API (ClawBot)

Readme

@zhin.js/adapter-weixin-ilink

通过微信 iLink Endpoint API(ClawBot 灰度入口)接入个人微信,支持文本与全量媒体收发、输入状态提示。

协议实现移植自 Tencent/openclaw-weixin(MIT),已去除 OpenClaw 耦合,bot_agent 默认为 Zhin.js/<version>

与 wechat-mp 的区别

| 项 | weixin-ilink | wechat-mp | |---|---|---| | 账号类型 | 个人微信(ClawBot) | 微信公众号 | | 入站 | 长轮询 getupdates | Webhook 被动回复 | | 登录 | 扫码 + 侧车凭证文件 | AppId/Secret/Token | | 群聊 | 不支持(仅私聊) | 支持 |

可与 @zhin.js/adapter-wechat-mp 同时启用

前置条件

  • 微信客户端需已灰度 ClawBot 入口(最新版微信 + 灰度资格)
  • Node.js ^20.19.0 或 >=22.12.0
  • 可选:@zhin.js/host-router + @zhin.js/host-api 用于 Web 控制台扫码登录

最小配置

endpoints:
  - context: weixin-ilink
    name: my-wechat
    # botAgent: "Zhin.js/1.0.0"      # 可选,观测用
    # longPollTimeoutMs: 35000       # 可选
    # baseUrl: https://ilinkai.weixin.qq.com

plugins:
  - "@zhin.js/adapter-weixin-ilink"
  - "@zhin.js/host-router"   # 可选,Console + login-assist API
  - "@zhin.js/host-api"      # 可选

zhin.config.yml 只写 bot namebotToken 保存在侧车文件(不进 git):

data/weixin-ilink/<bot-name>.json

也可通过环境变量 WEIXIN_ILINK_TOKEN 或配置项 botToken 覆盖(CI 场景)。

登录流程

  1. 首次启动无凭证时,bot 调用 get_bot_qrcode 并在控制台展示二维码(loginAssist
  2. 用户用微信扫码确认
  3. 后台轮询 get_qrcode_status 直至 confirmed,写入 data/weixin-ilink/<name>.json
  4. 调用 notifyStart 后进入长轮询

与 Host 同时启用时:

  • Console 页面:/weixin-ilink(概览 + 登录辅助)
  • HTTP API:GET /api/login-assist/pendingPOST /api/login-assist/submitPOST /api/login-assist/cancel
  • Endpoint 状态:GET /api/weixin-ilink/endpoints

Typing Indicator

私聊使用 iLink sendTyping API,在微信侧显示正在输入(非文本消息、非 reaction)。长任务期间每 5s 保活一次(keepaliveIntervalMs 可配)。

typingIndicator:
  enabled: true
  keepaliveIntervalMs: 5000
  privateConfig:
    type: typing

出站说明

回复必须携带入站时缓存的 context_token(按 endpointId + peerUserId)。若用户久未发消息导致 token 缺失,出站会拒绝并打 warn。

所有出站走标准链路:Message.$reply / Adapter.sendMessagebefore.sendMessageendpoint.$sendMessage

图文限制:微信单条消息不支持图文混排。适配器会自动:

  • 出站:先单独发文本,再发纯媒体(不带 caption)
  • 入站:若同一条 iLink 消息同时含文字与媒体,拆成两条 message.receive 事件

故障排查

| 现象 | 可能原因 | |---|---| | 无法扫码 / 无 ClawBot 入口 | 未灰度;需最新微信 + 灰度资格 | | 二维码过期 | 重启 Endpoint 重新获取 | | 发不出消息 | 缺少 context_token;让用户先发一条消息 | | errcode -14 | 会话过期,适配器自动暂停 1 小时后重试 | | Console 无待办 | 确认 host-router 已加载且访问 /weixin-ilink |

文档