Get Messages of a Chat
Retrieve messages from a specific chat. Messages are returned in ascending order (earliest to latest), up to limit messages (default 50).
Required token scopes: View all chats
A filter is required - provide either botSessionId, or both beforeTime and beforeId:
- Bot session - retrieve all messages from a specific bot session by providing
botSessionId. You can obtain this ID via Search Chats or Get Chat by Chat ID - the chat object includes abotStatefield (andpreviousBotSession) where you can find the sessionid. - Before time & before ID - cursor pagination, both parameters together: the response includes messages with a timestamp up to and including
beforeTime, excluding the message identified bybeforeId. To page backwards through history, pass the timestamp and_idof the oldest message you already have.
All status values, type enums and the ID cheat sheet: Enums & Common Fields.
הרשאות
API token generated in Texter: gear icon → Developers → API Tokens. When creating a token, assign it the scopes required by the endpoints you plan to call - each endpoint lists its required scopes.
פרמטרי נתיב
The unique identifier of the chat. You can obtain this value by using the Search Chats endpoint with the contact's phone number
פרמטרי שאילתה
The maximum number of messages to return. Defaults to 50
^[0-9]+$Return messages with a timestamp up to and including this value (Unix epoch milliseconds). Must be used together with beforeId
^[0-9]+$Message ID to exclude from the results (the cursor message). Must be used together with beforeTime
^[a-z0-9]+$Return only messages within the specified bot session (the bot state ID)
^[a-z0-9]+$תגובה
The matching messages plus the time range of the entire chat. Field-by-field reference: The Message object