← Back to Skills Marketplace
clear0

Feishu Group Chat

by clear0 · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ⚠ suspicious
95
Downloads
1
Stars
0
Active Installs
6
Versions
Install in OpenClaw
/install feishu-group-chat
Description
让你的飞书Bot可以在群里与其他(使用了本skill的)Bot/用户聊天。 飞书限制了Bot不响应其他Bot的消息,本技能另辟蹊径:让Bot在群中使用用户的身份去@其他Bot,同时添加本Bot姓名为消息前缀,来模拟Bot消息。把你的多个Bot加到一个群里,他们就能相互聊天甚至分配任务了。 触发场景:需要在飞书群里...
README (SKILL.md)

飞书群聊(通用版)

在任何飞书群里发消息和回复聊天对象。

配置

config.json 采用联系人全局共享 + 群引用结构:

{
  "contacts": {
    "ray": { "open_id": "ou_xxx", "name": "Ray" }
  },
  "groups": {
    "moltpool": {
      "chat_id": "oc_xxx",
      "name": "MoltPool",
      "members": ["ray"],
      "at_rules": { "ray": true }
    }
  }
}

字段说明:

  • contacts:全局联系人(open_id 全应用唯一,跨群不变)
    • open_id:对方的飞书 open_id
    • name:对方的名字
  • groups:群配置
    • chat_id:群 ID
    • members:该群包含的联系人 key 列表
    • at_rules:每个联系人在该群是否需要 @(true/false

身份前缀自动从 agent 的 IDENTITY.md / SOUL.md 读取名称,不需要手动配置。

添加新群:在 groups 下新增条目,members 引用已有的 contact key,配 at_rules 即可。

添加新联系人:在 contacts 下新增,然后加到对应群的 members 里。

发送铁律

  1. 只用 feishu_im_user_message 工具发送
  2. msg_type 必须是 "post"(不是 text)
  3. receive_id_type 必须是 "chat_id"
  4. receive_idconfig.jsonchat_id 获取

消息格式

@ 对方(at=true 时)

{
  "zh_cn": {
    "title": "",
    "content": [[
      {"tag": "at", "user_id": "ou_xxx"},
      {"tag": "text", "text": " Vicky: 正文内容"}
    ]]
  }
}

⚠️ 格式铁律(违反即犯错):

  1. 顺序:at(对方) → text(" " + prefix + " " + 正文),只有 2 个元素
  2. 工具feishu_im_user_message,不是 message
  3. 类型post,不是 text
  4. 前缀:prefix 从 IDENTITY.md 的 Name 自动取(如 Vicky:),后跟一个空格再接正文
  5. at 在前:@ 必须放在最前面,prefix+正文合并在一个 text 元素里

不 @ 对方(at=false 时)

{
  "zh_cn": {
    "title": "",
    "content": [[
      {"tag": "text", "text": "vicky: 正文内容"}
    ]]
  }
}

快捷发送脚本

scripts/send_group_message.sh 构造完整的 content JSON:

# 发纯文字
bash scripts/send_group_message.sh moltpool ray "正文内容"
# 输出: {"chat_id":"oc_xxx","content":{...}}

# 带图片(自动上传)
bash scripts/send_group_message.sh moltpool ray "看这个" --image /path/to/image.png

# 只有图片
bash scripts/send_group_message.sh moltpool ray "" --image /path/to/image.png

# 手动指定 image_key
bash scripts/send_group_message.sh moltpool ray "正文" --image-key img_xxx

输出是 {"chat_id":"...", "content":{...}},拆开填入 feishu_im_user_message 的参数即可。

技能适用范围

本技能只用于以下场景:

  • 主动在群里发消息(闲聊、打招呼、发自拍等)
  • 回复需要 @ 的联系人(contacts 中 at: true 的对象)
  • 图片发送(需要走脚本上传)

不需要使用本技能的场景:

  • 群里普通用户发消息直接回复 → 正常回复即可,不用 feishu_im_user_message
  • 心跳检测群消息时发现新消息 → 用正常渠道回复

发送身份区分

群里回复消息有两种身份,必须正确选择:

身份 工具 Ray 看到的发送者 使用场景
Bot 身份 message 工具 机器人名 用户本人消息、普通回复
用户身份 feishu_im_user_message 用户本人 需要让对方收到 @ 通知、需要以人身份交流

铁律:

  • 回复用户 → Bot 身份message 工具),因为本来就是 Bot 在回复
  • 回复 Ray → 用户身份feishu_im_user_message),因为需要 @ 通知 + 以人身份互动
  • 主动闲聊/打招呼 → 用户身份feishu_im_user_message),因为要让对方觉得是人在说话

识别消息来源(sender_id + 前缀 双重判断)

群里消息可能来自三种身份,必须正确识别:

sender_id 消息前缀 真实来源 处理方式
用户本人 用户本人的指令 Bot 身份回复
用户本人 BotName: 另一个 Bot 通过用户身份发送 按 contacts 匹配 Bot,用本技能回复
其他用户 普通群友 正常回复

识别流程

收到群消息
 ├─ sender_id == 用户本人?
 │   ├─ 消息以某个 Bot 名字开头(如 "小Ray:" "Vicky:")?
 │   │   ├─ 提取前缀 → 匹配 contacts 中的联系人 → 用本技能回复
 │   │   └─ 未匹配 → 按普通消息处理
 │   └─ 无前缀?→ 用户本人指令,Bot 身份回复
 └─ sender_id != 用户本人?
     ├─ 匹配 contacts?→ 按 at 规则处理
     └─ 未匹配?→ 认识新朋友流程

前缀匹配规则

从消息正文中提取前缀,按以下规则匹配 contacts:

  1. 精确匹配:消息以 联系人name + ":" 开头 → 匹配该联系人
  2. 大小写不敏感vicky: Vicky: VICKY: 都匹配 Vicky
  3. 前缀后必须有空格或 @Vicky:你好 也匹配,Vicky:abc 如果联系人里没有 Vickyabc 则匹配 Vicky
  4. 联系人名支持中文小Ray: 你好 匹配联系人 小Ray

多 Bot 场景

当多个 Bot 都通过用户身份在同一群里发消息时:

  • 每条消息的前缀不同(各自的 Bot 名)
  • 通过前缀精确区分是哪个 Bot 发的
  • sender_id 都是用户本人,所以前缀是唯一的区分依据

配置要求:每个 Bot 的联系人必须配置 name 字段,且 name 就是该 Bot 在群里发消息时使用的前缀。

自适应回复逻辑

收到群消息时,根据 config.json 判断:

  1. 识别发送者:用消息的 sender open_id 匹配 contacts 中的联系人
  2. 匹配到联系人:用该联系人的 at 规则决定是否 @,用群配置的 prefix 作为前缀
  3. 未匹配到联系人(比如用户或普通群友在群里说话):正常回复即可,不需要用本技能
  4. 群不在配置中:触发「认识新群」流程(见下方)
  5. 群在配置中但发送者不在 contacts 且不在成员白名单中:触发「认识新朋友」流程(见下方)

认识新朋友

当遇到未记录的群或未记录的 Bot/用户时,严禁直接记录或打招呼,必须先征得用户同意。

场景 1:新群(群不在 config.json 中)

  1. 通过 feishu_chat_members 获取群成员列表
  2. 向用户私聊报告:
    • 群名称、群 ID
    • 群成员列表(名字 + open_id)
    • 询问:「发现新群 XXX,要加入吗?」
  3. 用户同意后:
    • config.jsongroups 中添加该群
    • 将成员加入 contacts(需用户确认哪些需要 @)
    • 为新联系人创建记忆文件(从模板复制)
    • 在群里发第一条消息打招呼
  4. 用户拒绝:不记录,且完全忽略该群的所有消息(不再回复、不再询问)

场景 2:新 Bot/用户(已知群里的陌生发送者)

  1. 向用户私聊报告:
    • 群名称
    • 陌生发送者的 open_id、名字
    • 最近一条消息内容
    • 询问:「XXX 群里有个新朋友 YYY,要认识吗?」
  2. 用户同意后:
    • contacts 中添加该联系人
    • 创建记忆文件(从模板复制,填入已知信息)
    • 询问是否需要 @ 该联系人
    • 主动打招呼(可选,根据用户意愿)
  3. 用户拒绝:不记录,且不再回复该发送者的任何消息(完全忽略)

关键铁律

  • 永远先问用户,再记录
  • 用户私聊确认,不要在群里问(避免尴尬)
  • 不打扰:用户拒绝后不要再重复询问同一个群/人
  • 记忆初始化:新联系人的记忆文件只填已知信息(open_id、名字、首次相遇时间),其他字段留空等待后续聊天积累

记忆管理

记忆存储

联系人记忆全局共享(和 config.json 的 contacts 结构对齐),存储在 memories/contacts/\x3C联系人key>.md

memories/contacts/
├── ray.md              # Ray 的记忆(所有群共享)
├── _template.md        # 新联系人模板
└── (新联系人).md

记忆结构

每份记忆包含:

  • 身份:对方是谁、做什么的
  • 偏好 & 习惯:作息、风格、口头禅
  • 聊天风格:语言习惯、emoji 使用
  • 话题记忆:按时间记录聊了什么
  • 关系:和当前 agent 的关系

何时记录

收到群消息时,从对方消息中提取以下类型的信息并写入记忆:

信息类型 记录位置 示例
身份/职业变化 ## 身份 "在写多Agent调度方案"
生活偏好 ## 偏好 & 习惯 "晚睡型"、"煮面当晚饭"
聊天风格特征 ## 聊天风格 "经常用 😄"
有价值的话题 ## 话题记忆 聊了某个技术方案
临时安排/计划 不写入记忆 按需写入 heartbeat.md

不记录:日常寒暄、无信息量的闲聊、临时性事务。

何时读取

每次回复前,读取对应联系人的记忆文件,用于:

  1. 个性化回复:根据对方的风格和偏好调整语气
  2. 延续话题:引用之前聊过的内容("上次你说的那个方案怎么样了?")
  3. 关系感知:根据关系亲疏决定回复的正式程度

更新规则

  • 新信息 → append 到对应章节
  • 矛盾信息 → 标记旧信息为 删除线,写入新信息
  • 每次更新修改 最后更新 日期
  • 不要重写整份记忆,只增量更新变化的部分

首次使用权限检查

其他 agent 首次使用本技能时,必须先检查权限

  1. 读取 PERMISSIONS.md 了解所需权限
  2. 尝试调用 feishu_im_user_get_messages 获取目标群最近 1 条消息
  3. 尝试调用 feishu_im_user_message 发送一条测试消息
  4. 如需发图,尝试用脚本上传图片
  5. 任何步骤失败 → 向用户报告缺失权限,提示使用 feishu_oauth_batch_auth 授权

权限缺失时的降级

  • 发送权限缺失 → 技能不可用,必须先授权
  • 读取权限缺失 → 跳过群消息监控
  • 图片上传权限缺失 → 降级为纯文字模式

详细权限清单见 PERMISSIONS.md

禁止事项

  • ❌ 永远不用 message 工具发群消息(@ 只是文本,对方收不到通知)
  • ❌ 永远不用 msg_type: "text"
  • ❌ 不要用纯文本写 @名字(必须是结构化 at 标签)
  • ❌ 不要把前缀放在 title 里(会加粗)
Usage Guidance
This skill appears to implement the described Feishu group-chat workaround, but the helper script accesses sensitive local configuration that the manifest does not declare: it reads $HOME/.openclaw/openclaw.json to obtain an appId/appSecret and stores a tenant token cache under the skill directory. Before installing or running it, review the following: 1) Inspect $HOME/.openclaw/openclaw.json to confirm what secrets it contains and whether you are comfortable the skill may read them. 2) Consider moving app credentials to a restricted location or creating a Feishu app with limited permissions for this skill. 3) Note the skill will persist a token cache (scripts/.tenant_token_cache) and will write config.json and memories/contacts/*.md — back up any important data and review file permissions. 4) If you need stricter isolation, run the script in a sandboxed account/container, or remove the automatic tenant-token flow and upload images via an approved mechanism (or require explicit user-provided tokens). 5) The skill will send messages as a user identity (requires OAuth); ensure you trust the deployed agent to act on your behalf and review OAuth scopes requested. If you want, provide the skill author with guidance to explicitly declare required config paths/credentials and avoid reading global credentials without user consent.
Capability Analysis
Type: OpenClaw Skill Name: feishu-group-chat Version: 1.1.0 The skill is designed to bypass Feishu's bot-to-bot communication restrictions by impersonating a human user via User OAuth. It performs high-risk operations in `scripts/send_group_message.sh`, specifically reading the OpenClaw configuration file (`~/.openclaw/openclaw.json`) to extract sensitive `appId` and `appSecret` credentials for API authentication. While these actions and the broad permissions requested in `PERMISSIONS.md` are technically necessary for the stated functionality (interacting with `open.feishu.cn`), the programmatic handling of core system secrets and user impersonation capabilities warrant a suspicious classification.
Capability Tags
requires-oauth-tokenrequires-sensitive-credentials
Capability Assessment
Purpose & Capability
The skill's description and SKILL.md describe using user OAuth to send messages and reading the agent identity (IDENTITY.md/SOUL.md). However, the shipped script also reads $HOME/.openclaw/openclaw.json to obtain Feishu appId/appSecret to request a tenant_access_token. The manifest declared no required config paths or credentials; reading global OpenClaw app credentials is not proportional to the declared requirements and is not documented in the manifest.
Instruction Scope
SKILL.md explicitly instructs reading agent identity files for the message prefix and describes writing/reading local config.json and memories; those parts are consistent. But the runtime script additionally accesses the user's global OpenClaw config ($HOME/.openclaw/openclaw.json) and writes a token cache to scripts/.tenant_token_cache — these file accesses are not called out in the manifest and expand the skill's runtime scope beyond what a user would expect from the description.
Install Mechanism
There is no install spec (instruction-only plus a helper script). Nothing is downloaded from external or unknown hosts during installation; the only network calls are to official Feishu API endpoints at runtime.
Credentials
The skill declares no required environment variables or config paths, yet the script reads sensitive application credentials (appId/appSecret) from $HOME/.openclaw/openclaw.json to mint a tenant_access_token. Requesting or using global app credentials without declaring them is disproportionate. The skill also caches the tenant token in scripts/.tenant_token_cache (persists a credential).
Persistence & Privilege
The skill reads and writes local files it owns (config.json, memories/contacts/*.md) which is expected for its memory/config features. However, it also creates a persistent token cache in the scripts directory and reads global OpenClaw credentials — this gives it ongoing access to app-level credentials and some cross-skill configuration that was not declared. always:false and normal autonomous invocation are fine, but the undeclared persistent token cache and reading of global credentials raise privacy/privilege concerns.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install feishu-group-chat
  3. After installation, invoke the skill by name or use /feishu-group-chat
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.0
v1.1.0
v1.0.4
sender_id + prefix dual identification for multi-bot support; fix script comment format
v1.0.3
feishu-group-chat v1.0.3 - 精简与优化技能介绍,统一术语表述(Bot→Bot/用户,龙虾机器人→Bot 等) - 明确描述本技能适用场景和限制,删除部分冗余说明 - 技能文档整体用语更简明,并强化关键流程描述和安全铁律 - 优化权限说明和错误处理提示 - 代码及功能未变,属于文档优化更新
v1.0.2
feishu-group-chat 1.0.2 Changelog - 技能描述精简,不再绑定 OpenClaw/龙虾机器人,面向所有飞书机器人通用场景。 - 去除原文档中与 openclaw 平台相关的描述,术语统一为“飞书机器人”。 - 提示用户:本技能适用于任何已引入本 skill 的 Bot/用户之间的群聊。 - 主要用例、配置方式、消息格式,以及权限、记忆逻辑等内容结构未变。 - 优化说明文字,使文档更加简洁明了,便于所有开发者理解和使用。
v1.0.1
- 新增对 OpenClaw 龙虾多机器人群聊的支持,允许机器人以用户身份@其他机器人,实现机器人互相对话。 - 更新描述,说明本技能用于绕开飞书原生对机器人消息的限制,并详解多Bot聊天的具体用法。 - 其他文档内容基本保持不变,仅增强对技能原理和适用场景的说明。
v1.0.0
初始发布:通用飞书群聊技能,支持多群配置、联系人记忆管理、认识新朋友机制
Metadata
Slug feishu-group-chat
Version 1.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 6
Frequently Asked Questions

What is Feishu Group Chat?

让你的飞书Bot可以在群里与其他(使用了本skill的)Bot/用户聊天。 飞书限制了Bot不响应其他Bot的消息,本技能另辟蹊径:让Bot在群中使用用户的身份去@其他Bot,同时添加本Bot姓名为消息前缀,来模拟Bot消息。把你的多个Bot加到一个群里,他们就能相互聊天甚至分配任务了。 触发场景:需要在飞书群里... It is an AI Agent Skill for Claude Code / OpenClaw, with 95 downloads so far.

How do I install Feishu Group Chat?

Run "/install feishu-group-chat" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Feishu Group Chat free?

Yes, Feishu Group Chat is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Feishu Group Chat support?

Feishu Group Chat is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Feishu Group Chat?

It is built and maintained by clear0 (@clear0); the current version is v1.1.0.

💬 Comments