Browse SDKs · React Native
SDKsReact Native

Revoke a message

OpenIM React Native SDK guide for revoke a message.

Copy

Use revokeMessage() to revoke a sent message. Conversation members then see the message's revoked state.

await OpenIMSDK.revokeMessage({
  conversationID,
  clientMsgID,
});

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesConversation containing the message.
clientMsgIDstringYesID of the message to revoke.

After the call completes, the revocation request has completed. The server validates which messages, senders, and time ranges are eligible.

Listen for message revocation

When a message is revoked, OnNewRecvMessageRevoked is emitted with RevokedInfo. Use its clientMsgID to update the message's revoked state.

function handleMessageRevoked(revokedInfo) {
  // ...
}

// Set the listener
OpenIMSDK.on(OpenIMEvent.OnNewRecvMessageRevoked, handleMessageRevoked);

// Remove the listener
OpenIMSDK.off(OpenIMEvent.OnNewRecvMessageRevoked, handleMessageRevoked);

Remove the listener when the component is destroyed, the account signs out, or the account changes. To remove a message only from the current device, use Delete a local message.