Recall Message
Recall a successfully sent message.
By default, RC does not impose restrictions on who can recall messages. If restrictions are needed, consider the following options:
- The App client can enforce restrictions on who can recall messages. For example, regular users in the App may be prohibited from recalling messages sent by others, while administrators may be allowed to do so.
- To prevent users from recalling messages not sent by themselves, you can submit a ticket to enable the IMLib SDK feature that only allows recalling messages sent by oneself. This restriction is enforced at the RC server level, preventing users from recalling messages not sent by themselves.
Call recallMessage to recall a specific message.
tip
Electron
RC defines a recall notification message with the ObjectName RC:RcNtf
.
recallMessage
replaces the original message in the chat history with a recall notification message with the ObjectName RC:RcNtf
.
const conversation = {
conversationType: RongIMLib.ConversationType.PRIVATE,
targetId: '<Target ID>',
}
RongIMLib.recallMessage(conversation, {
messageUId: 'BS4O-QEBR-VJM6-9GPP',
sentTime: 1632728573423,
})
.then((res) => {
if (res.code === 0) {
console.log(res.code, res.data)
} else {
console.log(res.code, res.msg)
}
})
.catch((error) => {
console.log(error)
})
Parameter | Type | Description |
---|---|---|
conversation | IConversation | The conversation. System conversations are not supported. |
options | Message-related | Information about the message to be recalled. See the options parameter details below. |
-
options
parameter detailsParameter Type Required Description messageUId string Yes The UId of the message sentTime number Yes The sent time of the message user IUserProfile No User information carried by the recall message disableNotification boolean No Whether to send a silent message pushConfig IPushConfig No Mobile push configuration (similar to MessagePushConfig on Android and iOS) extra string No Extended information carried by the recall message. Supported in Web SDK starting from version 5.3.0. isDelete boolean No Specifies whether the mobile recipient should delete the original message record locally. When false
, the mobile end will not delete the original message record and will replace the message content with a recall notification (gray bar notification). Whentrue
, the mobile end will delete the original message record and will not display a recall notification (gray bar notification). Supported in Web SDK starting from version 5.3.1.