Skip to main content
Threaded messages (or threads) are messages started from a particular parent message. Each thread is attached to a parent message.

Send Message in a Thread

Any message type (Text, Media, or Custom) can be sent in a thread. Set the parentMessageId property to indicate which thread the message belongs to.

Send Text Message in Thread

Send Media Message in Thread

Send Custom Message in Thread

Receiving Real-Time Messages

Use CometChatMessageDelegate to receive real-time thread messages. Check if the received message belongs to the active thread using parentMessageId.

Fetch all the messages for any particular thread

Use MessagesRequestBuilder with setParentMessageId() to fetch messages belonging to a specific thread. The fetchPrevious() method returns an array of BaseMessage objects representing thread replies.

Avoid Threaded Messages in User/Group Conversations

Use hideReplies(hide: true) to exclude threaded messages when fetching messages for a conversation. The response is an array of BaseMessage objects, excluding any messages that are replies within a thread.

Offline support

With offline support enabled (SDK 4.2.0 or later), a thread fetch (a MessagesRequest with setParentMessageId(parentMessageId:)) has an overload that delivers the cached thread page first (onCachedMessages, even when empty), then the server copy (onServerMessages). Offline, the fetch ends with onError, code ERROR_INTERNET_UNAVAILABLE, after the cached page. A reply sent from a thread is queued like any other message. See Show Cached Data and Send While Offline.

Next Steps

Thread Subscription

Subscribe to or unsubscribe from a thread, and fetch the threads a user participates in

Send Messages

Send text, media, and custom messages to users and groups

Receive Messages

Listen for incoming messages in real-time and fetch missed messages

Reactions

Add emoji reactions to messages

Message Filtering

Advanced message filtering with RequestBuilder