read_p2p_messages
Read P2P direct message chat history using user access token, even for chats the bot cannot access. Auto-expands merge-forward messages and returns newest first.
Instructions
[User UAT] Read P2P (direct message) chat history using user_access_token. Works for chats the bot cannot access. Returns newest messages first by default. Auto-expands merge_forward messages into their child messages by default — disable with expand_merge_forward=false. Requires OAuth setup.
Sender semantics (v1.3.12): each message has a displayLabel (e.g. 周宇, [Bot] Claude聊天助手, [匿名], [系统], [已撤回] 怪兽) — prefer it over raw senderId when narrating who-said-what. Also surfaced: senderType (user|app|anonymous), senderIdType (open_id|union_id|user_id), senderTenantKey, isExternal (cross-tenant), isRecalled, isThreadReply (parent_id present).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | Chat ID (numeric from create_p2p_chat, or oc_xxx from list_user_chats). Both formats work. | |
| end_time | No | End timestamp in seconds (optional) | |
| page_size | No | Messages to fetch (default 20, max 50) | |
| sort_type | No | Sort order (default: ByCreateTimeDesc = newest first) | |
| page_token | No | Pagination cursor — pass the pageToken from a previous response to fetch the next (older) page when hasMore is true. | |
| start_time | No | Start timestamp in seconds (optional) | |
| expand_merge_forward | No | Auto-expand merge_forward placeholders into their child messages (default true). Children carry parentMessageId; use that id (not the child id) with download_message_resource (kind=image or file). |