read_p2p_messages
Fetch direct message chat history using a user access token, including chats inaccessible to the bot. Supports pagination, sorting, and auto-expansion of merged messages.
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.
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. | |
| page_size | No | Messages to fetch (default 20, max 50) | |
| start_time | No | Start timestamp in seconds (optional) | |
| end_time | No | End timestamp in seconds (optional) | |
| sort_type | No | Sort order (default: ByCreateTimeDesc = newest first) | |
| 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). |