React to a message in a group channel
Message reactions help you build a more engaging chat experience that goes beyond text messages. They are a quick and easy way for users to respond to a message. Users can express their feelings about a message by adding reactions instead of typing a response. They can also view and delete their reactions to the message.
Note: Message reactions are supported in Group and Supergroup channels. This feature isn't supported in Open channels and custom message types.
Add or remove a reaction
Retrieve reactions
You can decide how to display reactions that were added to messages in the current user’s chat view.
Note: The
getPreviousMessagesByTimestamp()method is deprecated as of August 2021. Use thegetMessagesByTimestamp()method instead.
Note: Messages along with their reactions can also be retrieved by using the
PreviousMessageListQuery'sload()method. To learn more, see the Retrieve a list of messages page.
Retrieve all reacted users
By default, each Reaction object's userIds property returns up to ten sampled user IDs. This limit applies to both group and supergroup channels. To change the default limit, contact sales.
To retrieve the full list of users who reacted to a message, call the List reactions Platform API with list_users set to true.
Retrieve the reaction count
To get the total number of users who reacted with a specific emoji, use the count property of the Reaction object.
Receive reaction events in real time
When one of the channel members reacts to a message, the onReactionUpdated() method in the channel event handler is invoked on all channel members’ devices including the one that belongs to the current user. The applyReactionEvent() method reflects the reaction change to the message in real time.