Browse SDKs · React Native
Platform
SDKsReact Native

Revoke a message

Recall a previously sent message within the permitted time window using the OpenIM React Native SDK.

Copy

Recall a previously sent message from a conversation:

Upon successful revocation, clients in the conversation update the message bubble to display a revocation placeholder (e.g., "Message was recalled").

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

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesTarget conversation ID.
clientMsgIDstringYesClient message ID of the message to revoke.

Return value

A resolved Promise confirms that the revocation request was accepted and processed by the server. Revocation time constraints (e.g. within 2 minutes) and role permissions are validated by server policy; exceeding the limit returns an error.

Listen for message revocations

When a message is recalled, all clients in the conversation receive the OnNewRecvMessageRevoked event. The callback payload contains a RevokedInfo object. Locate the target message by clientMsgID and update its display state to a recalled notice.

interface RevokedInfo {
  clientMsgID: string;
  revokerID: string;
  revokerRole: number;
  revokerNickname: string;
  sessionType: number;
}

const handleMessageRevoked = (revokedInfo: RevokedInfo) => {
  // Locate the message by revokedInfo.clientMsgID and update its status to revoked
};

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

// Unregister listener on cleanup
OpenIMSDK.off(OpenIMEvent.OnNewRecvMessageRevoked, handleMessageRevoked);

To remove a message strictly from the local device without alerting the counterparty, use Delete local message.