Skip to main content
Reactions let users respond to messages with emoji. You can add or remove reactions, fetch all reactions on a message, listen for reaction events in real time, and update your UI when reactions change. Reactions work on text messages, media messages, and custom messages.
Available via: SDK | REST API | UI Kits

Add a Reaction

Call addReaction() with a message ID and an emoji string.
On Success — A BaseMessage object representing the message with the reaction added:BaseMessage Object:
sender Object:
receiver Object:

Remove a Reaction

Call removeReaction() with the same message ID and emoji.
On Success — A BaseMessage object representing the message with the reaction removed:BaseMessage Object:
sender Object:
receiver Object:
Both addReaction() and removeReaction() return a BaseMessage object with the updated reactions.

Read Reaction Data from a Message

Any BaseMessage exposes reaction data through its reactions property:

Get All Reactions

Use the reactions property to retrieve the list of reactions on a message. Returns a List<ReactionCount> containing the reactions, or an empty list if no one has reacted.

Check if the Logged-in User Has Reacted

Use the reactedByMe property on any ReactionCount object to check whether the logged-in user has reacted with that particular emoji. Returns true if they have, false otherwise.

Fetch Reactions for a Message

To get the full list of who reacted with what on a specific message, use ReactionsRequestBuilder. You can paginate through results with fetchNext() and fetchPrevious() (max 100 per request).

Fetch Next

The fetchNext() method fetches the next set of reactions for the message.
The fetchNext() method returns a List<Reaction> representing individual user reactions on the message.
On Success — A list of Reaction objects for the message:Reaction Object (per item in list):
reactedBy Object:

Fetch Previous

The fetchPrevious() method fetches the previous set of reactions for the message.
On Success — A list of Reaction objects for the message:Reaction Object (per item in list):
reactedBy Object:

Real-Time Reaction Events

Register a MessageListener to receive reaction events as they happen. This is how you keep your UI in sync when other users add or remove reactions.
Each reaction listener callback receives a ReactionEvent object containing:

Remove the Listener

Always remove listeners when they’re no longer needed (e.g., in the dispose() method). Failing to remove listeners can cause memory leaks and duplicate event handling.

Update a Message with Reaction Info

When you receive a real-time reaction event, you’ll want to update the corresponding message object so your UI reflects the change. CometChatHelper.updateMessageWithReactionInfo() does this — it takes the BaseMessage instance, the Reaction event data, and the action type, then returns the updated message.
After calling this method, use modifiedBaseMessage?.reactions to get the latest reactions and refresh your UI.

Next Steps

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

Threaded Messages

Create and manage message threads

Mentions

Mention users and groups in messages