返回顶部
f

feishu-openapi-skill飞书开放API技能

Operate Feishu or Lark IM APIs through UXC with a curated OpenAPI schema, tenant-token bearer auth, and chat/message guardrails.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
201
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

feishu-openapi-skill

飞书 / Lark IM 技能

使用此技能通过 uxc + OpenAPI 执行飞书或 Lark IM 操作。

复用 uxc 技能以实现共享执行、认证和错误处理指导。

前置条件

  • - uxc 已安装并可在 PATH 中使用。
  • 可访问 https://open.feishu.cn/open-apis 或 https://open.larksuite.com/open-apis。
  • 可访问精选的 OpenAPI 模式 URL:
- https://raw.githubusercontent.com/holon-run/uxc/main/skills/feishu-openapi-skill/references/feishu-im.openapi.json
  • - 一个已启用机器人功能的飞书或 Lark 应用。
  • 飞书或 Lark 应用的 appid + appsecret,或者如果您使用手动回退路径,则需要当前的 tenantaccesstoken。

范围

此技能涵盖以 IM 为中心的请求/响应接口:

  • - 群聊查询
  • 群聊成员查询
  • 用于 IM 发送的图片和文件上传
  • 消息发送与回复
  • 选定消息历史读取
  • 通过联系人 API 进行基本用户查询

此技能涵盖:

  • - 文档、多维表格、审批或其他非 IM 产品系列
  • 完整的飞书或 Lark 开放平台接口

订阅状态

飞书和 Lark 提供了超出普通请求/响应 API 的事件投递模型,包括平台生态系统中的长连接事件投递。

当前 uxc subscribe 状态:

  • - 请求/响应 IM 操作已验证
  • 通过内置的 feishu-long-connection 传输方式验证了入站消息接收
  • 实时验证确认了真实的 im.message.receive_v1 事件已投递到 p2p 机器人聊天的订阅接收器中

重要的运行时说明:

  • - feishu-long-connection 是 uxc subscribe 内部的一种感知提供者的传输方式;它不是普通的原始 WebSocket 流
  • 运行时从 /callback/ws/endpoint 打开一个临时 WebSocket URL
  • 帧是 protobuf 二进制消息,而非文本 JSON
  • 运行时会自动发送所需的事件确认和 ping 控制帧

端点选择

此模式适用于飞书或 Lark 开放平台的基础 URL:

  • - 中国/飞书默认:https://open.feishu.cn/open-apis
  • 国际/Lark 替代:https://open.larksuite.com/open-apis

下面的固定链接示例使用飞书。对于 Lark,请使用相同的模式 URL 指向 Lark 基础主机。

认证

飞书和 Lark 服务端 API 对这些操作使用 Authorization: Bearer accesstoken>。

首选设置是将 appid + appsecret 存储为凭证字段,并让 uxc auth bootstrap 自动获取和刷新短期租户令牌。

飞书引导管理设置:

bash
uxc auth credential set feishu-tenant \
--auth-type bearer \
--field appid=env:FEISHUAPP_ID \
--field appsecret=env:FEISHUAPP_SECRET

uxc auth bootstrap set feishu-tenant \
--token-endpoint https://open.feishu.cn/open-apis/auth/v3/tenantaccesstoken/internal \
--header Content-Type=application/json; charset=utf-8 \
--request-json {appid:{{field:appid}},appsecret:{{field:appsecret}}} \
--access-token-pointer /tenantaccesstoken \
--expires-in-pointer /expire \
--success-code-pointer /code \
--success-code-value 0

uxc auth binding add \
--id feishu-tenant \
--host open.feishu.cn \
--path-prefix /open-apis \
--scheme https \
--credential feishu-tenant \
--priority 100

对于 Lark,请使用相同的引导形状指向 Lark 主机,并将凭证绑定到 open.larksuite.com。

要使用长连接订阅,凭证仍需要 appid 和 appsecret 字段,因为传输方式会在正常的 Bearer 令牌请求路径之外打开自己的临时事件 URL。

如果您已有租户令牌,手动回退方式:

bash
curl -sS https://open.feishu.cn/open-apis/auth/v3/tenantaccesstoken/internal \
-H Content-Type: application/json; charset=utf-8 \
-d {appid:clixxx,app_secret:xxxx}

Lark 在 Lark 主机上使用相同的路径形状:

bash
curl -sS https://open.larksuite.com/open-apis/auth/v3/tenantaccesstoken/internal \
-H Content-Type: application/json; charset=utf-8 \
-d {appid:clixxx,app_secret:xxxx}

配置一个 Bearer 凭证并将其绑定到飞书 API 主机:

bash
uxc auth credential set feishu-tenant \
--auth-type bearer \
--secret-env FEISHUTENANTACCESS_TOKEN

uxc auth binding add \
--id feishu-tenant \
--host open.feishu.cn \
--path-prefix /open-apis \
--scheme https \
--credential feishu-tenant \
--priority 100

对于 Lark,针对 open.larksuite.com 创建相同的绑定:

bash
uxc auth binding add \
--id lark-tenant \
--host open.larksuite.com \
--path-prefix /open-apis \
--scheme https \
--credential feishu-tenant \
--priority 100

当认证看起来有问题时,检查或预热引导状态:

bash
uxc auth bootstrap info feishu-tenant
uxc auth bootstrap refresh feishu-tenant

当认证看起来有问题时,验证活动绑定:

bash
uxc auth binding match https://open.feishu.cn/open-apis

核心工作流程

  1. 1. 默认使用固定链接命令:
- command -v feishu-openapi-cli - 如果缺失,创建它: uxc link feishu-openapi-cli https://open.feishu.cn/open-apis --schema-url https://raw.githubusercontent.com/holon-run/uxc/main/skills/feishu-openapi-skill/references/feishu-im.openapi.json - feishu-openapi-cli -h
  1. 2. 首先检查操作模式:
- feishu-openapi-cli get:/im/v1/chats -h - feishu-openapi-cli post:/im/v1/images -h - feishu-openapi-cli post:/im/v1/files -h - feishu-openapi-cli post:/im/v1/messages -h - feishu-openapi-cli get:/im/v1/messages -h
  1. 3. 在写入之前优先进行读取/设置验证:
- feishu-openapi-cli get:/im/v1/chats page_size=20 - feishu-openapi-cli get:/im/v1/chats/{chatid} chatid=oc_xxx - feishu-openapi-cli get:/contact/v3/users/{userid} userid=ouxxx useridtype=openid
  1. 4. 使用键值对或位置 JSON 执行:
- 键值对: feishu-openapi-cli get:/im/v1/messages containeridtype=chat containerid=ocxxx page_size=20 - 多部分上传: feishu-openapi-cli post:/im/v1/images image_type=message image=/tmp/example.png - 位置 JSON: feishu-openapi-cli post:/im/v1/messages receiveidtype=chatid {receiveid:ocxxx,msgtype:text,content:{\text\:\Hello from UXC\}}
  1. 5. 对于入站消息接收,直接使用 uxc subscribe:
- uxc subscribe start https://open.feishu.cn/open-apis --transport feishu-long-connection --auth feishu-tenant --sink file:$HOME/.uxc/subscriptions/feishu.ndjson - 发送一条机器人可见的消息,然后在接收器中检查 header.eventtype = im.message.receivev1

操作组

群聊读取

  • - get:/im/v1/chats
  • get:/im/v1/chats/{chatid}
  • get:/im/v1/chats/{chatid}/members

消息读取/写入

  • - get:/im/v1/messages
  • get:/im/v1/messages/{messageid}
  • post:/im/v1/messages
  • post:/im/v1/messages/{messageid}/reply

上传

  • -

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 feishu-openapi-skill-1776069850 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 feishu-openapi-skill-1776069850 技能

通过命令行安装

skillhub install feishu-openapi-skill-1776069850

下载

⬇ 下载 feishu-openapi-skill v1.0.1(免费)

文件大小: 9.41 KB | 发布时间: 2026-4-15 12:43

v1.0.1 最新 2026-4-15 12:43
- Added support for image and file uploads to Feishu/Lark IM via `post:/im/v1/images` and `post:/im/v1/files`.
- Updated documentation to include new upload endpoints, parameter guidance, and multipart/form-data usage.
- Expanded operation examples in the workflow section to demonstrate image/file upload commands.
- Refined scope and guardrails to clarify supported request types and file upload requirements.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部