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

@timoxue/openclaw-feishu-relay

v1.6.2

Published

OpenClaw Feishu Relay Channel - Connect to Feishu Relay Server for multi-user support

Downloads

1,332

Readme

OpenClaw Feishu Relay Channel

OpenClaw 通道插件,通过 Feishu 中继服务器实现多用户支持。

功能特性

  • 多用户支持: 多个 OpenClaw 实例共享同一个飞书机器人
  • 消息路由: 中继服务器按飞书 user_id 路由消息到对应的 OpenClaw 实例
  • 自动重连: WebSocket 连接断开后自动重连
  • 心跳保持: 自动发送心跳保持连接活跃
  • 认证支持: JWT Token 认证机制

架构

┌──────────────────────────────────────────────┐
│         飞书平台(1个机器人)                    │
│         App: cli_a902d36ce638dcb2           │
└───────────────────┬──────────────────────────┘
                    │
                    ▼
┌──────────────────────────────────────────────┐
│          Feishu 中继服务器                     │
│         按飞书 user_id 路由消息                │
└─────┬──────────────┬──────────────┬──────────┘
      │              │              │
      ▼              ▼              ▼
┌─────────┐    ┌─────────┐    ┌─────────┐
│OpenClaw A│    │OpenClaw B│    │OpenClaw C│
│用户 A专属 │    │用户 B专属 │    │用户 C专属 │
└─────────┘    └─────────┘    └─────────┘

安装

方法 1: 使用交互式安装脚本(推荐)

# 克隆仓库
git clone https://github.com/timoxue/openclaw-channel-feishu-relay.git
cd openclaw-channel-feishu-relay

# 运行安装脚本(会自动安装插件并进入配置流程)
node install.js

方法 2: 手动安装

cd ~/.openclaw/extensions
git clone https://github.com/timoxue/openclaw-channel-feishu-relay.git
cd openclaw-channel-feishu-relay
npm install

或使用 npm 直接安装(发布后):

npm install @timoxue/openclaw-feishu-relay
openclaw-feishu-relay-setup

配置

运行交互式配置脚本

插件安装后,运行配置脚本:

# 如果在插件目录中
npm run setup

# 或者直接运行
node scripts/setup.js

配置脚本会引导你完成以下步骤:

  1. 配置中继服务器连接

    • 输入中继服务器地址(默认: 43.160.237.217)
    • 输入 API 端口(默认: 5178)
    • 输入 WebSocket 端口(默认: 5179)
  2. 飞书 OAuth 授权

    • 自动打开浏览器显示二维码登录页面
    • 使用飞书 App 扫描二维码
    • 在飞书中授权登录
    • 复制显示的 Token 并粘贴到配置脚本
  3. 获取 LLM 配置

    • 自动从中继服务器获取 glm-4.7 的 API key
    • 自动获取机器人应用的 appid 和 appsecret
  4. 更新 OpenClaw 配置

    • 自动更新 ~/.openclaw/openclaw.json
    • 自动启用插件

手动配置

如果想手动配置,编辑 ~/.openclaw/openclaw.json:

{
  "channels": {
    "feishu-relay": {
      "enabled": true,
      "relayUrl": "ws://YOUR_RELAY_SERVER_IP:5179",
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
  }
}

配置说明

| 字段 | 必填 | 说明 | |------|------|------| | enabled | 是 | 是否启用该通道 | | relayUrl | 是 | 中继服务器 WebSocket 地址 | | token | 是 | 从中继服务器获取的认证 Token |

消息格式

接收消息 (飞书 → OpenClaw)

{
  platform: 'feishu',
  userId: 'ou_xxxxx',
  chatId: 'oc_xxxxx',
  chatType: 'p2p',
  messageId: 'om_xxxxx',
  timestamp: '2026-02-13T10:30:00.000Z',
  content: '用户发送的消息',
  raw: {
    type: 'message',
    content: '用户发送的消息',
    messageId: 'om_xxxxx',
    chatType: 'p2p',
    chatId: 'oc_xxxxx'
  }
}

发送消息 (OpenClaw → 飞书)

文本消息:

await channel.sendText('ou_xxxxx', '回复的消息');

富文本消息:

await channel.sendPost('ou_xxxxx', {
  post: {
    zh_cn: {
      title: '标题',
      content: [[{ tag: 'text', text: '内容' }]]
    }
  }
});

API

方法

| 方法 | 参数 | 说明 | |------|------|------| | start() | - | 启动通道 | | stop() | - | 停止通道 | | sendText(to, text) | to: 飞书user_id, text: 文本内容 | 发送文本消息 | | sendPost(to, content) | to: 飞书user_id, content: 富文本内容 | 发送富文本消息 | | sendMessage(to, content) | to: 飞书user_id, content: 消息内容 | 发送消息 | | getStatus() | - | 获取通道状态 | | getQRCodeUrl() | - | 获取二维码登录页面 URL | | getSetupInfo() | - | 获取配置说明和步骤 |

事件

通道会触发以下事件到 OpenClaw:

  • message: 收到新消息时触发

中继服务器部署

参见: openclaw-relay-server

环境变量

FEISHU_APP_ID=cli_a902d36ce638dcb2
FEISHU_APP_SECRET=your_app_secret
FEISHU_ENCRYPT_KEY=
PORT=5178
WS_PORT=5179

Docker 部署

git clone https://github.com/timoxue/openclaw-relay-server.git
cd openclaw-relay-server
cp .env.example .env
# 编辑 .env 配置
docker-compose up -d

故障排查

认证失败

检查:

  1. Token 是否正确
  2. Token 是否过期
  3. 中继服务器是否正常运行

消息无法接收

检查:

  1. OpenClaw 是否已连接并认证成功
  2. 飞书 user_id 是否正确
  3. 中继服务器日志

连接断开

  • 通道会自动重连,无需手动处理
  • 检查网络连接和中继服务器状态

许可证

MIT License

相关项目