Skip to main content

Get chat messages

GET 

/chat.history

List messages in a chat, filtered by date range (after/before).

Messages with contentType of text, voice, or poll are returned. System messages and other content types are excluded.

Specify ONE of the following:

  • chatId - Fetch from an existing chat by its ID
  • groupId - Fetch from a group chat
  • userIds - Fetch from a DM or Multi-DM with the specified users

You must specify exactly one destination. Specifying multiple (e.g., both chatId and groupId) will return a 400 error.

The ordering of results depends on ascending and after:

  • ascending=true sorts in forward chronological order (oldest first). ascending=false sorts in reverse chronological order (newest first), even when after is specified.

  • When ascending is omitted and after is not specified, the most recent messages are returned in reverse chronological order. This is equivalent to specifying before as NOW and leaving after unspecified.

  • When ascending is omitted and after is specified, the results are sorted in forward chronological order.

Send the same ascending value on every page. The cursor marks where to resume, not which direction to sort.

Either dates or datetimes may be specified. Date-only inputs (YYYY-MM-DD) are interpreted in the caller's timezone (see Timezone handling).

Access: Organization tokens need to be a member of the chat (403 not_in_chat otherwise). Personal tokens can read any chat the owner can, including public groups in their roam they have not joined. Full membership matrix: Chat.

Required scope: chat:history

Every returned sender includes userId plus userType. The ID resolves through user.info with the same credentials.


OpenAPI Spec: chat-v1.json

Request​

Responses​

Messages retrieved successfully