Skip to main content
Messages that are started from a particular message are called Threaded messages or simply threads. Each Thread is attached to a message which is the Parent message for that thread.

Send Message in a Thread

Any message type (TextMessage, MediaMessage, or CustomMessage) can be sent in a thread. Set the parentMessageId using setParentMessageId() to indicate which thread the message belongs to.
Media and Custom messages can also be sent in threads using setParentMessageId().

Receiving Real-Time Messages

Use MessageListener to receive real-time thread messages. Check if the received message belongs to the active thread using getParentMessageId().

Fetch Thread Messages

Use MessagesRequestBuilder with setParentMessageId() to fetch messages belonging to a specific thread. Call fetchPrevious() to get messages (max 100 per request).

Avoid Threaded Messages in User/Group Conversations

Use hideReplies(true) to exclude threaded messages when fetching messages for a conversation.
The above snippet will return messages between the logged in user and cometchat-uid-1 excluding all the threaded messages belonging to the same conversation.

Next Steps

Send Messages

Learn how to send text, media, and custom messages

Receive Messages

Handle real-time message events with listeners

Message Structure

Understand message objects and their properties

Reactions

Add emoji reactions to messages