Style 1 | |
Style 2 | |
addMessageReaction
API to add an emoji to a message. After adding successfully, the current operating user will be stored under the emoji.removeMessageReaction
API to delete the added emoji. After deleting successfully, the current operating user will no longer be stored under the emoji.getMessageReactions
API to batch pull the emoji list of multiple messages, where each emoji contains the total number of current users and the first N (default 10) users profiles.getAllUserListOfMessageReaction
API to paginate and pull the full list of user profiles using the message emoji.onRecvMessageReactionsChanged
callback to perceive changes in the user profile of emojis. This callback will carry the latest user profile of the emoji, including the total number of users and the first N user profiles.addMessageReaction
API to add a message reaction.import { TencentImSDKPlugin } from 'react-native-tim-js';TencentImSDKPlugin.v2TIMManager.getMessageManager().addMessageReaction({msgID: msgID,reactionID: 'emoji',});
Input Parameter | Definition | Description |
msgID | Message ID | The message must be in a Sent successfully status. |
reactionID | Message reaction ID | In the emoji reaction scenario, the reactionID represents the emoji ID. |
removeMessageReaction
API to remove a message reaction.import { TencentImSDKPlugin } from 'react-native-tim-js';TencentImSDKPlugin.v2TIMManager.getMessageManager().removeMessageReaction({msgID: msgID,reactionID: 'emoji',});
Input Parameter | Definition | Description |
msgID | Message ID | The message must be in a Sent successfully status. |
reactionID | Message response ID | In the emoji reaction scenario, the reactionID represents the emoji ID. |
getMessageReactions
API to get multiple message reactions in batches.import { TencentImSDKPlugin } from 'react-native-tim-js';TencentImSDKPlugin.v2TIMManager.getMessageManager().getMessageReactions({msgIDs: [msgID],maxUserCountPerReaction: 10,});
Input Parameter | Definition | Description |
msgIDs | List of Message IDs | The messages must belong to the same conversation, and they must have been sent successfully. |
maxUserCountPerReaction | Each Reaction returns the maximum user profile quantity | The value range is [0,10]. Each reaction only returns the first 10 user profiles at most. If you need more user profile, you can call the getAllUserListOfMessageReaction interface to pull by page. |
Input Parameter | Definition | Description |
resultCode | Return code | 0: indicates success. Non-zero: indicates failure. |
resultInfo | Return message | Error message. |
msgID | Message ID | Unique ID of the message. |
reactionList | Message reaction list | List of V2TIMMessageReaction message reaction objects. |
V2TIMMessageReaction
object are as follows:Input Parameter | Definition | Description |
reactionID | Message reaction ID | In the emoji reaction scenario, the reactionID represents the emoji ID. |
totalUserCount | Total count of users | The total count of users who have added reaction using the same reactionID. |
partialUserList | Partial user list | The partial list of users who added reaction message using the same reactionID. The count of users in the list depends on the maxUserCountPerReaction value set when calling the getMessageReactions API. |
reactedByMyself | Whether I have used this reaction | If this reaction is used, the return value is true. |
getAllUserListOfMessageReaction
API to get all messages reaction of the user list in pages.import { TencentImSDKPlugin } from 'react-native-tim-js';TencentImSDKPlugin.v2TIMManager.getMessageManager().getAllUserListOfMessageReaction({msgID: msgID,reactionID: 'emoji',nextSeq: 0,count: 10,});
Input Parameter | Definition | Description |
message | Message ID | The message must be in a Sent successfully status. |
reactionID | Message reaction ID | In the emoji reaction scenario, the reactionID represents the emoji ID. |
nextSeq | The next pulling-by-page cursor | Pass 0 for the first time, and pass the nextSeq returned by succ for subsequent pages. |
count | The maximum count of users fetched per page | Up to 100. |
addAdvancedMsgListener
, you will receive the onRecvMessageReactionsChanged
callback when message reaction information is updated.totalUserCount
field in the changed Reaction information is set to 0, it means that no users are using this Reaction, and you can remove the display of this Reaction from the UI.import { TencentImSDKPlugin } from 'react-native-tim-js';TencentImSDKPlugin.v2TIMManager.getMessageManager().addAdvancedMsgListener({onRecvC2CReadReceipt: ( receiptList) {}, // C2C recipient user conversation read notification (when the recipient user calls markC2CMessageAsRead, you will receive this notification)onRecvMessageModified: ( message) {}, // The content of the message has been modifiedonRecvMessageReadReceipts: ( receiptList) {}, // Notification of message read receipt (if the message I sent supports read receipts, when the recipient calls sendMessageReadReceipts, I will receive this notification).onRecvMessageRevoked: ( messageid) {}, // Received a message recall notificationonRecvNewMessage: ( message) {}, // Received a new messageonSendMessageProgress: ( message, progress) {}, // Event for upload message progressonRecvMessageReactionsChanged: (msgID, reactionList){}, // Message reaction updated});
Was this page helpful?