Skip to main content
GET
/
chats
/
{chat_id}
/
messages
Get filtered chat history (messages only) of the chat
curl --request GET \
  --url https://app.timelines.ai/integrations/api/chats/{chat_id}/messages \
  --header 'Authorization: Bearer <token>'
{
  "status": "ok",
  "data": {
    "has_more_pages": true,
    "messages": [
      {
        "uid": "de919486-0c93-409d-ae66-c2bbb544faca",
        "chat_id": "1000001",
        "timestamp": "2023-06-18 15:19:23 +0300",
        "sender_phone": "+972540000001",
        "sender_name": "John Doe",
        "recipient_phone": "+972540000002",
        "recipient_name": "Kate Smith",
        "from_me": true,
        "status": "Read",
        "origin": "Public API",
        "has_attachment": true,
        "message_type": "Note",
        "data": {
          "key1": "value1",
          "key2": "value2"
        },
        "created_by": "Kate Smith",
        "text": "Hello, Kate👍",
        "attachment_url": "https://acme.com/logo.png",
        "attachment_filename": "logo.png",
        "reactions": {
          "👍": "2",
          "❤️": "5"
        }
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

chat_id
integer
required

an id of the chat as appears in TimelinesAI (can be found in the URL of the chat page, or in the payload of outbound webhook). Supports sending messages to a group.

Query Parameters

from_me
boolean

specify true to filter messages sent from my WhatsApp account (from any session), false to filter messages received from other WhatsApp users.

after
string

can specify date or datetime in ISO format to filter out messages created AFTER the specified date (inclusive)

before
string

can specify date or datetime in ISO format to filter out messages created BEFORE the specified date (inclusive)

after_message
string

can specify message uid to filter out messages created after the specified message (excluding the specified message itself)

before_message
string

can specify message uid to filter out messages created before the specified message (excluding the specified message itself)

sorting_order
enum<string>

order messages by timestamp, according to possible values: asc, desc

Available options:
asc,
desc

Response

Success

status
enum<string>
required
Available options:
ok,
error
Example:

"ok"

data
object
required