Feishu Chat
Apps & Automationfeishu-chatFeishu Chat is an Agent Skill for apps & automation published in the hyperlist/feishu-multi-agent repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
飞书群聊管理:创建群、添加/移除成员、修改群信息。需要 exec 权限执行 curl 命令。
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/hyperlist/feishu-multi-agent/blob/HEAD/skills/feishu-chat/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/feishu-chat, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
飞书群聊管理
通过飞书 Open API 管理群聊。需要 exec 权限。
前置条件
- 飞书应用已开通
im:chat:create、im:chat:update、im:chat.members:write_only权限 - 准备好
app_id和app_secret
获取 Token
每次操作前先获取 tenant_access_token(有效期 2 小时):
TOKEN=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json" \
-d '{"app_id":"<YOUR_APP_ID>","app_secret":"<YOUR_APP_SECRET>"}' \
| python3 -c "import json,sys; print(json.load(sys.stdin)['tenant_access_token'])")
echo $TOKEN
操作
创建群聊
curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/chats" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "群名称", "chat_mode": "group", "chat_type": "private"}'
返回 data.chat_id(如 oc_xxx)。
添加成员
curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/chats/{chat_id}/members" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"id_list": ["ou_用户open_id"]}'
移除成员
curl -s -X DELETE "https://open.feishu.cn/open-apis/im/v1/chats/{chat_id}/members" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"id_list": ["ou_用户open_id"]}'
修改群信息
curl -s -X PUT "https://open.feishu.cn/open-apis/im/v1/chats/{chat_id}" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "新群名", "description": "群描述"}'
踩坑经验
- Bot 自动为群主 — 创建时不指定
owner_id,Bot 自动成为群主 - 不能直接加 Bot 不可见的用户 — 创建后通过 members API 可以加
- 跨租户 open_id 不通用 — 不同飞书租户中同一用户的 open_id 不同
- 创建后需注册 — 在 openclaw.json 添加 binding + groups 配置后重启
- Token 有效期 2 小时 — 长时间操作需重新获取