Skip to main content

Recall Message

Recall Message

Recall a specific message. Only successfully sent messages can be recalled.

By default, RC does not impose restrictions on who can recall messages. If restrictions are needed, consider the following solutions:

  • The App client can restrict who can recall messages. For example, regular users in the App business are not allowed to recall messages sent by others, while administrators in the App business are allowed to recall messages sent by others.
  • To prevent users from recalling messages not sent by themselves, you can submit a ticket to enable the IMLib SDK to only allow recalling messages sent by the user. This restriction is enforced by the RC server, preventing users from recalling messages not sent by themselves.

Method


recallMessage(
message: RCIMIWMessage,
callback: IRCIMIWRecallMessageCallback
): Promise<number>;

Parameter Description

ParameterTypeDescription
messageRCIMIWMessageThe message to be recalled
callbackIRCIMIWRecallMessageCallbackCallback for the interface call result.

Return Value

Return ValueDescription
numberThe status code of the current interface operation. 0 indicates a successful call. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. Refer to the error codes for detailed errors.

Code Example


const callback = {
onMessageRecalled: (code: number, message: RCIMIWMessage) => {
//...
},
};
let code = await engine.recallMessage(message, callback);

Listen to Message Recall Event

Used to listen for events where a received message has been recalled. When a received message is recalled, this listener will be triggered.

Method

setOnRemoteMessageRecalledListener(listener?: (message: RCIMIWMessage) => void): void;

Parameter Description

ParameterTypeDescription
messageRCIMIWMessageThe original message will be replaced with a recall message

Code Example


engine?.setOnRemoteMessageRecalledListener((message: RCIMIWMessage) => {
//...
});