דלג לתוכן הראשי
GET
/
messages
/
chat
/
{chatId}
curl -g "https://YOUR_PROJECT.texterchat.com/server/api/v2/messages/chat/67bf11038b24880cc966f799?beforeTime=1762012091000&beforeId=68ba8c904657483ffee3101e" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "messages": [
    {
      "_id": "68ba89f8c909657dffcf267c",
      "chatChannelInfo": {
        "name": "whatsapp",
        "id": "972521234567",
        "accountId": "972509876543"
      },
      "channelInfo": {
        "id": "wamid.HBgMOTcyNTQ0NTU0ODUyFQIAEhgUM0ExNkMwMzdBN0Q0MDFEN0E4RUUA"
      },
      "direction": "incoming",
      "parent_chat": "67a87067aeedqdee1271ck4d",
      "status": 2,
      "statusHistory": [
        {
          "status": 2,
          "timestamp": 1757055477000
        }
      ],
      "text": "Hi",
      "timestamp": 1757055477000,
      "type": "text",
      "updatedAt": "2025-09-05T06:58:01.651Z",
      "metadata": {
        "triggeredBot": true
      },
      "botSessionId": "c1125880930b372b0f1047cad91ab5aca4f1171993d8af709497d16f77772fa4"
    }
  ],
  "minTime": 1746616143295,
  "maxTime": 1757056145969
}

הרשאות

Authorization
string
header
נדרש

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.

פרמטרי נתיב

chatId
string
נדרש

The unique identifier of the chat. You can obtain this value by using the Search Chats endpoint with the contact's phone number

פרמטרי שאילתה

limit
string

The maximum number of messages to return. Defaults to 50

Pattern: ^[0-9]+$
beforeTime
string

Return messages with a timestamp up to and including this value (Unix epoch milliseconds). Must be used together with beforeId

Pattern: ^[0-9]+$
beforeId
string

Message ID to exclude from the results (the cursor message). Must be used together with beforeTime

Pattern: ^[a-z0-9]+$
botSessionId
string

Return only messages within the specified bot session (the bot state ID)

Pattern: ^[a-z0-9]+$

תגובה

The matching messages plus the time range of the entire chat. Field-by-field reference: The Message object

messages
object[]
minTime

Timestamp (ms) of the first-ever message in the chat, or false if the chat has no messages

maxTime

Timestamp (ms) of the most recent message in the chat, or false if the chat has no messages