Skip to main content

Overview

A convenience hook that wraps useLiveChatMessages and useSendMessage for a specific message thread. Returns the thread’s replies and a sendReply function that automatically sets parentMessageId.
Requires ChatProvider in the component tree.

Usage Example

Props

string
required
The ID of the conversation that contains the thread.
string
required
The ID of the parent message whose thread to load.

Returns

ChatMessage[]
Thread replies in ascending order (oldest first). See ChatMessage.
boolean
true while a fetch is in progress.
boolean
true if there are more replies to load.
() => Promise<void>
Fetches the next page of newer replies. No-ops if loading is true or hasMore is false.
(params: Omit<SendMessageParams, 'parentMessageId'>) => Promise<ChatMessage>
Sends a reply to this thread. Accepts the same parameters as useSendMessage except parentMessageId (set automatically). Returns the confirmed ChatMessage.

Notes

  • The thread is live: new replies (including your own), edits, deletions, removals and reactions appear as they happen, and replies sent while the socket was disconnected are loaded when it reconnects.
  • For integration guidance, see Chat: Threads.