read_chat_history
Reads a chat's latest messages, newest first: id, timestamp, sender and text (media as placeholders like "[voice note, 0:42]"; fetch the file with download_media). Returns { chat, participants?, messages }: chat is the conversation and, in groups, participants maps each message's sender_jid to that sender, both with the contact fields (name; name_source: address_book, push_name, group_subject, business, phone or unresolved; canonical_jid: the JID to pass to send_message and read_chat_history; phone_jid and lid_jid: the chat's phone-number and LID forms, null when unknown or for groups; phone_display: the number as +). Covers about the last 90 days. jid can be a chat JID or a phone number. A message someone edited shows its latest text with edited: true; edits made with edit_message don't show yet (its text stays the original here). A page holds up to limit messages but stops early when they are long; to go further back, pass the before the headline gives (the id of the oldest message shown). To reply to one of these messages, pass its id as quote_id to send_message (in groups, also its sender_jid as quote_participant). Get chat JIDs from get_recent_chats or search_contacts.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jid | Yes | The chat: a JID (…@s.whatsapp.net, …@lid, …@g.us) or a phone number with country code. | |
| limit | Yes | Number of messages to return, newest first (e.g. 20; max 200). | |
| before | No | Optional. For older messages: the `id` of the oldest message of the previous page, as the headline gives it. The page then starts just before that message. |