| name | feishu-chat-history |
| description | 获取飞书聊天记录并总结。触发词:获取聊天记录、总结聊天、聊天历史、chat history、获取消息、拉取记录、所有消息、全部记录。必须使用 feishu_get_chat_history 工具,禁止使用 browser。 |
| metadata | {"openclaw":{"emoji":"💬","requires":{"config":["channels.feishu"]}}} |
feishu-chat-history
获取飞书群聊和单聊的历史消息记录。
⚠️ 重要:使用 feishu_get_chat_history 工具
不要使用 browser 工具!必须使用 feishu_get_chat_history 工具获取聊天记录。
参数说明
| 参数 | 必填 | 类型 | 说明 |
|---|
| chat_id | 是 | string | 会话 ID(以 oc_ 开头) |
| fetch_all | 否 | boolean | 是否获取所有消息。设为 true 时自动分页获取全部记录 |
| limit | 否 | number | 消息数量限制。fetch_all=false 时默认 50;fetch_all=true 时默认 5000 |
| sort_order | 否 | string | desc(最新在前,默认)或 asc(最早在前) |
| start_time | 否 | string | 起始时间戳(秒) |
| end_time | 否 | string | 结束时间戳(秒) |
使用场景
1. 获取最新消息(默认)
用户问「最近聊了什么」「看看聊天记录」:
{
"name": "feishu_get_chat_history",
"arguments": {
"chat_id": "oc_xxx"
}
}
2. 获取所有消息(用户要求总结/分析全部)
用户问「总结所有聊天」「阅读全部记录」「获取所有消息」:
{
"name": "feishu_get_chat_history",
"arguments": {
"chat_id": "oc_xxx",
"fetch_all": true,
"sort_order": "asc"
}
}
注意:获取所有消息时建议使用 sort_order: "asc",这样消息按时间顺序排列,更方便阅读和总结。
3. 获取指定时间范围
用户问「看看上周的聊天」「1月份的记录」:
{
"name": "feishu_get_chat_history",
"arguments": {
"chat_id": "oc_xxx",
"fetch_all": true,
"start_time": "1704067200",
"end_time": "1706745600",
"sort_order": "asc"
}
}
获取 chat_id
从消息前缀中提取:
[Feishu 金哲帆 (ou_xxx) in oc_906e0d54a80ca26d2836ac5951992bee (单聊)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
这就是 chat_id
或者用户会直接告诉你 chat_id。
处理流程
-
判断用户意图:
- 想看最新消息 →
fetch_all: false(默认)
- 想总结/分析全部 →
fetch_all: true
-
调用工具获取消息
-
处理结果:
凭证说明
- 租户访问令牌(access_token)由 OpenClaw 飞书扩展或运行时注入,Skill 描述与仓库中不包含任何 API Key/Token。
- 若通过配套脚本
feishu-chat-history.js 独立调用,须在命令行传入 access_token 或通过环境变量配置,切勿在代码或文档中写明文密钥。
注意事项
- fetch_all 会获取大量数据,只在用户明确要求「所有」「全部」「总结」时使用
- 禁止使用 browser:这是内部 API
- 权限:只能获取机器人所在群/对话的消息
- 最大限制:fetch_all 最多获取 5000 条消息