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 the filter specified:

  • When no parameters are provided, the most recent messages are returned, sorted in reverse chronological order. This is equivalent to specifying before as NOW and leaving after unspecified.

  • If after is specified, the results are sorted in forward chronological order.

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.

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