Skip to main content

Overview

useFetchManyChatMessages returns a function that fetches a single page of conversation messages and resolves to the raw response. It stores nothing — no Redux, no socket subscription — so you own the resulting state. This is the low-level fetcher shared by useLiveChatMessages (the live store-backed view) and useFetchManyChatMessagesWrapper (a batteries-included paginated list). Use it directly when you need full control; most apps will prefer the wrapper.
Because results never enter the live store, this is the right tool for filtered or read-only queries (e.g. only messages that have replies) that should not be polluted by live socket traffic. It is a point-in-time query — call it again to refresh.

Usage Example

Parameters

string
required
The ID of the conversation to query.
string | null
Restrict to thread replies of this message.
string | null
Keyset cursor (ISO timestamp): messages created before this. Mutually exclusive with after.
string | null
Keyset cursor (ISO timestamp): messages created after this. Mutually exclusive with before.
number
Page size (1–100). Defaults to 50.
"asc" | "desc"
Sort by creation time.
boolean
When true, the server populates the files field on each message.
string
Resolves each message sender’s reputation into a spaceReputation number on the embedded user. Accepts a space <uuid>, "none" (project-general bucket), or "context" (server-derived from the request context). Empty string, "general", and null are rejected. See Reputation.
boolean
When true, spaceReputation is the subtree sum (the space plus all its descendants). Only honored when spaceReputationId is an explicit <uuid>.
MessageFilters
Optional filters. filters.hasReplies (boolean): when true, returns only messages that have thread replies (threadReplyCount > 0); when false, only messages with none. Filters by thread replies, not quotings.
Threads are one level deep, so hasReplies: true together with parentId always returns an empty list — the response’s notice field explains why.

Returns

A Promise resolving to:
ChatMessage[]
Messages for the requested page. When spaceReputationId is set, each embedded sender carries an added spaceReputation number. See ChatMessage and Reputation.
boolean
Whether more messages exist in the requested direction.
string | null
ISO timestamp of the oldest message in this page; null if empty.
string | null
ISO timestamp of the newest message in this page; null if empty.
string
Present only when a filter combination can’t return results — e.g. hasReplies: true together with parentId. Explains why the list is empty.