feishu_im_user_get_messages
Retrieve historical messages from Feishu/Lark group chats or direct conversations using chat ID or user ID, with time filtering and pagination support.
Instructions
【以用户身份】获取群聊或单聊的历史消息。
用法:
通过 chat_id 获取群聊/单聊消息
通过 open_id 获取与指定用户的单聊消息(自动解析 chat_id)
支持时间范围过滤:relative_time(如 today、last_3_days)或 start_time/end_time(ISO 8601 格式)
支持分页:page_size + page_token
【参数约束】
open_id 和 chat_id 必须二选一,不能同时提供
relative_time 和 start_time/end_time 不能同时使用
page_size 范围 1-50,默认 50
返回消息列表,每条消息包含 message_id、msg_type、content(AI 可读文本)、sender、create_time 等字段。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| open_id | No | 用户 open_id(ou_xxx),获取与该用户的单聊消息。与 chat_id 互斥 | |
| chat_id | No | 会话 ID(oc_xxx),支持单聊和群聊。与 open_id 互斥 | |
| sort_rule | No | 排序方式,默认 create_time_desc(最新消息在前) | |
| page_size | No | 每页消息数(1-50),默认 50 | |
| page_token | No | 分页标记,用于获取下一页 | |
| relative_time | No | 相对时间范围:today / yesterday / day_before_yesterday / this_week / last_week / this_month / last_month / last_{N}_{unit}(unit: minutes/hours/days)。与 start_time/end_time 互斥 | |
| start_time | No | 起始时间(ISO 8601 格式,如 2026-02-27T00:00:00+08:00)。与 relative_time 互斥 | |
| end_time | No | 结束时间(ISO 8601 格式,如 2026-02-27T23:59:59+08:00)。与 relative_time 互斥 |