Returns messages in a room using cursor-based pagination. Messages are returned in descending order (newest first).
Room messages are stored in time partitions (~28-day windows, ~12 partitions per room per year). Partition boundaries are room-specific. The shard_has_more field indicates if more messages exist in the current partition.
To retrieve all messages in a room:
next_cursor_sent_at and next_cursor_message_id until shard_has_more is falsenext_partition_cursor as cursor_sent_at to query the next older partitioncreated_at timestampThe next_partition_cursor is always returned (calculated from the partitioning algorithm). Use the room's created_at to determine when to stop querying older partitions.
messages Array
id String
roomId String
userId String
threadParentMessageId String
inlineReplyMessageId String
parentRecordingId String
recordingPositionTimestamp Integer
hasAttachedBlocks Boolean
richContent Object
children Array
children Array
children Array (max depth)
detail Integer (max depth)
format Integer (max depth)
mode String (max depth)
style String (max depth)
text String (max depth)
type String (max depth)
mentionName String (max depth)
isUnlinked Boolean (max depth)
rel String (max depth)
target String (max depth)
title String (max depth)
url String (max depth)
direction String (max depth)
indent Integer (max depth)
version Integer (max depth)
checked Boolean (max depth)
value Integer (max depth)
language String (max depth)
listType String (max depth)
textFormat Integer (max depth)
textStyle String (max depth)
mentionUserId String (max depth)
direction String
format String
indent Integer
type String
textFormat Integer
textStyle String
version Integer
tag String
start Integer
listType String
language String
direction String
format String
indent Integer
type String
version Integer
status String ENUM
reactions Array
userId String
emojis Object
emojiIds Array of String
updatedAt String
receipts Array
userId String
readAt String
attachments Array
id String
fileId String
fileUrl String
displayName String
type String ENUM
createdAt String
updatedAt String
sentAt String
scheduledSendAt String
deletedAt String
createdAt String
updatedAt String
threadRepliesCount Integer
threadUsersIds Array of String
lastThreadReplyAt String
type String ENUM
callEndedAt String
nextCursorSentAt String
nextCursorMessageId String
shardHasMore Boolean
nextPartitionCursor String Always returned. Provides the timestamp to use as cursor_sent_at to query the next older partition. Calculated from the room-specific partitioning algorithm. Clients should use the room's created_at to determine when to stop querying older partitions.
code Integer The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
message String A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
details Array
@type String The type of the serialized message.
Was this guide helpful?