Skip to main content

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)
})
ParameterTypeDescription
conversationIConversationThe conversation. System conversations are not supported.
optionsMessage-relatedInformation about the message to be recalled. See the options parameter details below.
  • options parameter details

    ParameterTypeRequiredDescription
    messageUIdstringYesThe UId of the message
    sentTimenumberYesThe sent time of the message
    userIUserProfileNoUser information carried by the recall message
    disableNotificationbooleanNoWhether to send a silent message
    pushConfigIPushConfigNoMobile push configuration (similar to MessagePushConfig on Android and iOS)
    extrastringNoExtended information carried by the recall message. Supported in Web SDK starting from version 5.3.0.
    isDeletebooleanNoSpecifies 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). When true, 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.