← 返回 Skills 市场
shaniu001

Feishu Webhook Skill

作者 ShaNiu001 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
149
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install feishu-webhook-skill
功能描述
Must Use this skill to send Feishu(飞书/Lark) webhook msgs. Supports plain text, rich text (post), and interactive card messages. Handles image upload via tena...
使用说明 (SKILL.md)

以下是向飞书发送Webhook发送消息的专业技能。

工作流程

  1. 确认配置:确认用户已配置飞书Webhook地址和必要的认证信息
  2. 分析需求:分析用户需求,确定消息类型和内容
    • 纯文本消息:简单的文字通知
    • 富文本消息(post):支持格式化文本、链接、@提及、图片、代码块等
    • 交互式卡片(interactive):复杂的卡片布局,支持按钮、表单、图表等可视化组件
  3. 处理图片(如需要):如果需要发送图片,先使用 scripts/upload_image.py 脚本获取 image_key。必须阅读 webhook-image.md 文档了解发送图片的要求
  4. 构建消息内容:按照飞书API规范构建正确的消息JSON结构
  5. 发送消息:通过Webhook接口将消息发送到飞书
  6. 验证结果:验证消息发送结果并向用户反馈

注意事项

  • 本文提供的示例代码中所有的 receive_id(消息接收者 ID)、user_id(用户的 user_id)、image_key(上传图片后获取到的图片标识 key)、file_key(上传文件后获取到的文件标识 Key) 等参数值均为示例数据。你在实际开发过程中,需要替换为真实可用的数据。

  • 如果需要发送的内容涉及图片,必须阅读 webhook-image.md 文档来了解发送图片的要求。

  • 发送消息前务必确认Webhook地址的正确性

  • 对于包含图片的消息,必须先上传图片获取 image_key

  • 卡片消息结构较复杂,需仔细参考文档构建

环境要求

  • 需要配置 FEISHU_TENANT_ACCESS_TOKEN 环境变量用于图片上传
  • 需要用户提供飞书群的 Webhook 地址

消息内容介绍

发送消息回复消息编辑消息 接口中,均需要传入消息内容(content),不同的消息类型对应的 content 也不相同。以文本类型的消息为例,请求体示例如下:

{
    "receive_id": "ou_7d8a6e6df7621556ce0d21922b676706ccs",
    "content": "{\"text\":\" test content\"}",
    "msg_type": "text"
}

注意content 字段为 string 类型,JSON 结构需要先进行转义再传值。在调用接口时,你可以先构造一个结构体,然后使用 JSON 序列化转换为 string 类型,或者通过第三方的 JSON 转换工具进行转义。

各类型的消息内容 JSON 结构

富文本 post

在一条富文本消息中,支持添加文字、图片、视频、@、超链接等元素。如下 JSON 格式的内容是一个富文本示例,其中:

  • 一个富文本可分多个段落(由多个 [] 组成),每个段落可由多个元素组成,每个元素由 tag 和相应的描述组成。
  • 图片、视频元素必须是独立的一个段落。
  • 实际发送消息时,需要将 JSON 格式的内容压缩为一行、并进行转义。
  • 如需参考该 JSON 示例构建富文本消息内容,则需要把其中的 user_id、image_key、file_key 等示例值替换为真实值。
{
	"zh_cn": {
		"title": "我是一个标题",
		"content": [
			[
				{
					"tag": "text",
					"text": "第一行:",
					"style": ["bold", "underline"]

},
				{
					"tag": "a",
					"href": "http://www.feishu.cn",
					"text": "超链接",
					"style": ["bold", "italic"]
				},
				{
					"tag": "at",
					"user_id": "ou_1avnmsbv3k45jnk34j5",
					"style": ["lineThrough"]
				}
			],
          	[{
				"tag": "img",
				"image_key": "img_7ea74629-9191-4176-998c-2e603c9c5e8g"
			}],
			[
				{
					"tag": "text",
					"text": "第二行:",
					"style": ["bold", "underline"]
				},
				{
					"tag": "text",
					"text": "文本测试"
				}
			],
          	[{
				"tag": "img",
				"image_key": "img_7ea74629-9191-4176-998c-2e603c9c5e8g"
			}],
          	[{
				"tag": "media",
				"file_key": "file_v2_0dcdd7d9-fib0-4432-a519-41d25aca542j",
				"image_key": "img_7ea74629-9191-4176-998c-2e603c9c5e8g"
			}],
          	[{
				"tag": "emotion",
				"emoji_type": "SMILE"
			}],
			[{
				"tag": "hr"
			}],
			[{
				"tag": "code_block",
				"language": "GO",
				"text": "func main() int64 {\
    return 0\
}"
			}],
			[{
				"tag": "md",
				"text": "**mention user:**\x3Cat user_id=\"ou_xxxxxx\">Tom\x3C/at>\
**href:**[Open Platform](https://open.feishu.cn)\
**code block:**\
```GO\
func main() int64 {\
    return 0\
}\
```\
**text styles:** **bold**, *italic*, ***bold and italic***, ~underline~,~~lineThrough~~\
> quote content\
\
1. item1\
    1. item1.1\
    2. item2.2\
2. item2\
 --- \
- item1\
    - item1.1\
    - item2.2\
- item2"
			}]
		]
	},
	"en_us": {
		...
	}
}

参数说明

名称 类型 是否必填 描述
zh_cn, en_us object 多语言配置字段。如果不需要配置多语言,则仅配置一种语言即可。\x3Cbr>- zh_cn 为富文本的中文内容\x3Cbr>- en_us 为富文本的英文内容\x3Cbr>注意:该字段无默认值,至少要设置一种语言。\x3Cbr>示例值:zh_cn
∟ title string 富文本消息的标题。\x3Cbr>默认值:空\x3Cbr>示例值:title
∟ content string 富文本消息内容。由多个段落组成(段落由[]分隔),每个段落为一个 node 列表,所支持的 node 标签类型以及对应的参数说明,参见下文的 富文本支持的标签和参数说明 章节。\x3Cbr>注意:如 示例值 所示,各类型通过 tag 参数设置。例如文本(text)设置为 "tag": "text"。\x3Cbr>示例值:[[{"tag": "text","text": "text content"}]]

富文本支持的标签和参数说明

  • text:文本标签
名称 类型 是否必填 描述
text string 文本内容。\x3Cbr>示例值:test content
un_escape boolean 是否 unescape 解码。默认为 false,无需使用可不传值。\x3Cbr>示例值:false
style []string 文本内容样式,支持的样式有:\x3Cbr>- bold:加粗\x3Cbr>- underline:下划线\x3Cbr>- lineThrough:删除线\x3Cbr>- italic:斜体\x3Cbr>注意:\x3Cbr>- 默认值为空,表示无样式。\x3Cbr>- 传入的值如果不是以上可选值,则被忽略。\x3Cbr>示例值:["bold", "underline"]
  • a:超链接标签
名称 类型 是否必填 描述
text string 超链接的文本内容。\x3Cbr>示例值:超链接
href string 超链接地址。\x3Cbr>注意:请确保链接地址的合法性,否则消息会发送失败。\x3Cbr>示例值:https://open.feishu.cn
style []string 超链接文本内容样式,支持的样式有:\x3Cbr>- bold:加粗\x3Cbr>- underline:下划线\x3Cbr>- lineThrough:删除线\x3Cbr>- italic:斜体\x3Cbr>注意:\x3Cbr>- 默认值为空,表示无样式。\x3Cbr>- 传入的值如果不是以上可选值,则被忽略。\x3Cbr>示例值:["bold", "italic"]
  • at:@标签
名称 类型 是否必填 描述
user_id string 用户 ID,用来指定被 @ 的用户。传入的值可以是用户的 user_id、open_id、union_id。各类 ID 获取方式参见如何获取 User ID、Open ID 和 Union ID。\x3Cbr>注意:\x3Cbr>- @ 单个用户时,该字段必须传入实际用户的真实 ID。\x3Cbr>- 如需 @ 所有人,则该参数需要传入 all
style []string at 文本内容样式,支持的样式有:\x3Cbr>- bold:加粗\x3Cbr>- underline:下划线\x3Cbr>- lineThrough:删除线\x3Cbr>- italic:斜体\x3Cbr>注意:\x3Cbr>- 默认值为空,表示无样式。\x3Cbr>- 传入的值如果不是以上可选值,则被忽略。\x3Cbr>示例值:["lineThrough"]
  • img:图片标签
名称 类型 是否必填 描述
image_key string 图片 Key。通过上传图片接口可以获取到图片 Key(image_key)。\x3Cbr>示例值:d640eeea-4d2f-4cb3-88d8-c964fab53987
  • media:视频标签
名称 类型 是否必填 描述
file_key string 视频文件的 Key。通过上传文件接口上传视频(mp4 格式)后,可以获取到视频文件 Key(file_key)。\x3Cbr>示例值:file_v2_0dcdd7d9-fib0-4432-a519-41d25aca542j
image_key string 视频封面图片的 Key。通过上传图片接口可以获取到图片 Key(image_key)。\x3Cbr>默认值:空,表示无视频封面。\x3Cbr>示例值:img_7ea74629-9191-4176-998c-2e603c9c5e8g
  • emotion:表情标签
名称 类型 是否必填 描述
emoji_type string 表情文案类型。可选值参见表情文案说明。\x3Cbr>示例值:SMILE
  • code_block:代码块标签
名称 类型 是否必填 描述
language string 代码块的语言类型。可选值有 PYTHON、C、CPP、GO、JAVA、KOTLIN、SWIFT、PHP、RUBY、RUST、JAVASCRIPT、TYPESCRIPT、BASH、SHELL、SQL、JSON、XML、YAML、HTML、THRIFT 等。\x3Cbr>注意:\x3Cbr>- 取值不区分大小写。\x3Cbr>- 不传值则默认为文本类型。\x3Cbr>示例值:GO
text string 代码块内容。\x3Cbr>示例值:func main() int64 {\
return 0\
}
  • hr:分割线标签

富文本支持 tag 取值为 hr,表示一条分割线,该标签内无其他参数。

  • md:Markdown 标签warning 注意
  • md 标签会独占一个或多个段落,不能与其他标签在同一行。
  • md 标签仅支持发送,获取消息内容时将不再包含此标签,会根据 md 中的内容转换为其他相匹配的标签。
  • 引用、有序、无序列表在获取消息内容时,会简化为文本标签(text)进行输出。

md 标签内通过 text 参数设置 Markdown 内容。

名称 类型 是否必填 描述
text string Markdown 内容。支持的内容参见下表。\x3Cbr>示例值:1. item1\
2. item2

text 参数内支持的语法如下表所示。

语法 示例 说明
@ 用户 \x3Cat user_id="ou_xxxxx">User\x3C/at> 支持 @ 单个用户或所有人。\x3Cbr>- @ 单个用户时,需要在 user_id 内传入实际用户的真实 ID。传入的值可以是用户的 user_id、open_id、union_id。各类 ID 获取方式参见如何获取 User ID、Open ID 和 Union ID。\x3Cbr>- 如需 @ 所有人,需要将 user_id 取值为 all
超链接 [Feishu Open Platform](https://open.feishu.cn) 在 Markdown 语法内,[] 用来设置超链接的文本内容、() 用来设置超链接的地址。 \x3Cbr>注意:请确保链接地址的合法性,否则只发送文本内容部分。
有序列表 `1. item1\
2. item2` Markdown 配置说明:\x3Cbr>- 每个编号的 . 符与后续内容之间要有一个空格。\x3Cbr>- 每一列独立一行。如示例所示,可使用 `\
换行符换行。\x3Cbr>- 支持嵌套多层级。\x3Cbr>- 每个层级缩进 4 个空格,且编号均从1.` 开始。\x3Cbr>- 可以与无序列表混合使用。
无序列表 `- item1\
  • item2| Markdown 配置说明:\x3Cbr>- 每列的-符与后续内容之间要有一个空格。\x3Cbr>- 每一列独立一行。如示例所示,可使用
    换行符换行。\x3Cbr>- 支持嵌套多层级。\x3Cbr>- 每个层级缩进 4 个空格。\x3Cbr>- 可以与有序列表混合使用,有序列表以1. 开始编号。 代码块 | \``GO
    func main(){
    return
    }
    ``` | 代码块内容首尾需要使用 ``` 符号包裹,首部 ``` 后紧跟代码语言类型。支持的语言类型有 PYTHON、C、CPP、GO、JAVA、KOTLIN、SWIFT、PHP、RUBY、RUST、JAVASCRIPT、TYPESCRIPT、BASH、SHELL、SQL、JSON、XML、YAML、HTML、THRIFT 等(不区分大小写)。 引用 | > demo | 引用内容。> 符与后续内容之间要有一个空格。 分割线 | \ --- \ | 如示例所示,前后需要各有一个 \ 换行符。 加粗 | **加粗文本** | 配置说明:\x3Cbr>- ** 符与加粗文本之间不能有空格。\x3Cbr>- 加粗可以与斜体合用。例如 ***加粗+斜体***。\x3Cbr>- 加粗的文本不支持再解析其他组件。例如文本为超链接则不会被解析。 斜体 | *斜体文本* | 配置说明:\x3Cbr>- * 符与加粗文本之间不能有空格。\x3Cbr>- 斜体可以与加粗合用。例如 ***加粗+斜体***。\x3Cbr>- 斜体的文本不支持再解析其他组件。例如文本为超链接则不会被解析。 下划线 | ~下划线文本~ | 配置说明:\x3Cbr>- ~ 符与下划线文本之间不能有空格。\x3Cbr>- 下划线的文本不支持再解析其他组件。例如文本为超链接则不会被解析。\x3Cbr>- 不支持与加粗、斜体、删除线合用。 删除线 | ~~删除线~~ | 配置说明:\x3Cbr>- ~~ 符与下划线文本之间不能有空格。\x3Cbr>- 删除线的文本不支持再解析其他组件。例如文本为超链接则不会被解析。\x3Cbr>- 不支持与加粗、斜体、下划线合用。

卡片 interactive

飞书卡片是一种可以灵活构建图文内容的消息类型:

  1. 你应该阅读 webhook-card-common.md来了解卡片结构的详情。
  2. 必须阅读 webhook-card-content.md 和webhook-card-container.md 来了解卡片的构造
  3. 如果涉及到复杂图表的可视化,则阅读webhook-card-visual.md
安全使用建议
This skill is internally consistent with its stated purpose: it sends Feishu/Lark webhook messages and uploads images to the official open.feishu.cn API. Before installing/use, confirm these points: 1) You will need to provide a FEISHU_TENANT_ACCESS_TOKEN (or pass it to the upload script via --token) and a valid Feishu webhook URL — do not share these tokens publicly. 2) The package metadata did not declare Python dependencies; ensure the environment has requests and requests_toolbelt installed to run scripts/upload_image.py. 3) The skill posts only to open.feishu.cn (the official API) — if you require stricter scope, prefer a token with minimal privileges or use a bot/webhook token scoped to the target chat. 4) The registry metadata omitted required env var info; ask the publisher to update metadata to list required env vars and dependencies. If you need the skill to run autonomously, consider the usual operational risk of granting any skill access to a tenant-wide token — rotate the token if it is ever shared or no longer needed.
功能分析
Type: OpenClaw Skill Name: feishu-webhook-skill Version: 1.0.0 The feishu-webhook-skill bundle is a legitimate set of tools and documentation for sending messages to Feishu (Lark). The core logic in scripts/upload_image.py is a straightforward implementation for uploading images to the official Feishu Open API endpoint (open.feishu.cn) using standard libraries. The SKILL.md and accompanying documentation files provide clear, helpful instructions for the AI agent to construct various message types (text, rich text, and interactive cards) without any evidence of prompt injection, data exfiltration, or malicious intent.
能力评估
Purpose & Capability
Name/description match the actual files and instructions: SKILL.md documents sending text/post/card webhook messages and image upload; scripts/upload_image.py implements uploading images to open.feishu.cn using a tenant_access_token. No unrelated credentials, binaries, or endpoints are requested.
Instruction Scope
Runtime instructions stay on-purpose: they ask the agent to confirm a webhook URL, construct message JSON, optionally upload images (via the included script), send via Feishu webhook, and verify results. The SKILL.md does not instruct reading unrelated files or exfiltrating data to third-party endpoints.
Install Mechanism
This is instruction-only (no install spec), so nothing is automatically downloaded. However, the included Python script uses external packages (requests, requests_toolbelt) but the skill metadata does not declare dependencies or an install step — an operational omission rather than a malicious action. Ensure those Python packages are available before using the script.
Credentials
SKILL.md requires FEISHU_TENANT_ACCESS_TOKEN (used by upload_image.py) and the user's Feishu webhook URL — both are appropriate for the stated purpose. Registry metadata, however, lists no required env vars; that mismatch is an inconsistency you should note. No other secrets or unrelated env vars are requested.
Persistence & Privilege
The skill does not request persistent/always-on presence, does not modify other skills or system settings, and does not request elevated privileges. Autonomous invocation remains enabled by default (normal behavior).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install feishu-webhook-skill
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /feishu-webhook-skill 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
feishu-webhook-skill v1.0.0 - Initial release providing Feishu (Lark) webhook messaging capabilities. - Supports sending plain text, rich text (post), and interactive card messages. - Includes detailed documentation for constructing and sending messages via Feishu webhook, including message content types and JSON structures. - Handles image upload with tenant_access_token; instructions for image handling included. - Describes workflow steps, required environment variables, and usage precautions. - Trigger keywords: 飞书, Feishu, Lark, webhook, 消息, 卡片, 富文本, 通知, 群消息.
元数据
Slug feishu-webhook-skill
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 0
历史版本数 1
常见问题

Feishu Webhook Skill 是什么?

Must Use this skill to send Feishu(飞书/Lark) webhook msgs. Supports plain text, rich text (post), and interactive card messages. Handles image upload via tena... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 149 次。

如何安装 Feishu Webhook Skill?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install feishu-webhook-skill」即可一键安装,无需额外配置。

Feishu Webhook Skill 是免费的吗?

是的,Feishu Webhook Skill 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Feishu Webhook Skill 支持哪些平台?

Feishu Webhook Skill 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Feishu Webhook Skill?

由 ShaNiu001(@shaniu001)开发并维护,当前版本 v1.0.0。

💬 留言讨论