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 🙏

© 2025 – Pkg Stats / Ryan Hefner

feishu-webhook-bot

v0.0.7

Published

### 飞书 webhook 机器人

Readme

feishu-webhook-bot

飞书 webhook 机器人

飞书群组机器人分为两种。

一种是单向的基于 webhook 机器人,优点是配置简单,群组设置里就能配置好。缺点是只能单向发送消息,没有交互能力。

另一种是后台配置的应用型机器人,优点是具备交互能力,缺点是有一定的学习成本。

这个 bot 是 webhook 型。

Usage

npm i --save feishu-webhook-bot

yarn add feishu-webhook-bot

创建一个 bot 对象来调用方法:

const Bot = require("feishu-webhook-bot");

// class 第一个参数是群组设置里的 webhook 地址,设置了签名校验的话,第二个参数传入密钥。
const bot = new Bot(
  "https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
);

// 返回一个 Promise Promise 结果是飞书返回的 Response { StatusCode: 0, StatusMessage: 'success' }
bot.sendText("hello world!");

API

sendTet(text) 官方文档

发送一个文本消息
| 参数 | 类型 | 说明 |
| - | - | - |
| text | String | 需要发送的文本 |

Example:

bot.sendText("hello world!");

alt send_text

sendRich(richContent) 官方文档

发送一个复杂文本消息
| 参数 | 类型 | 说明 |
| - | - | - |
| richContent | Object | 对象 |

richContent

| 参数 | 类型 | 说明 | | ------- | -------- | ---------------------------------- | | title | String | 标题 | | content | Array | 内容二维数组,每个数组代表一行消息 |

content

[[{ tag: "text", "text": "hello" }] ]
单行消息数组内容为内容对象,tag 支持 4 种类型: text, a, at, img

text

{ tag: "text", "text": "hello" }
text: 文本内容 [必填]
un_escape: 是否解码 [可选]

a

{ tag: "a", text: "链接", href: "https://xx.xx" }
text: 链接内容 [必填]
href: 地址 [可选]

at

{ tag: "at", user_id: "all", use_name: "所有人" }
user_id: open_id,union_id 或 user_id [必填]
user_name: 用户姓名 [可选]

img

{ image_key: "xxxxxxxxxxxxxx" }
image_key: 上传到飞书的文件 key [必填]

Example:

bot.sendRich({
  title: "rich title",
  content: [
    [
      {
        tag: "text",
        text: "测试",
      },
      {
        tag: "a",
        href: "http://github.com",
        text: "测试",
      },
    ],
    [
      {
        tag: "at",
        user_id: "all",
      },
    ],
  ],
});

alt send_rich