revokeMessage
Feature Introduction
Description
Recall a message. Supports recalling messages sent by oneself or messages from group members recalled by administrators and group owners.
Note
After the recall, the original message will be transformed into a recall notification message with a message type of 2101, and it will still be in its original position. Related Callbacks: onNewRecvMessageRevoked onConversationChanged If the last message is recalled, the most recent message of the conversation will change.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future revokeMessage({
required String conversationID,
required String clientMsgID,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
conversationID | String | Yes | Conversation ID |
clientMsgID | String | Yes | Message ID |
Return Result
Name | Type | Description |
---|---|---|
~ | ~ | Operation successful if no exception is thrown |
Code Example
await OpenIM.iMManager.messageManager.revokeMessage(
"conversationID":"conversationID",
"clientMsgID":"clientMsgID",
);
// todo
Function Prototype
- (void)revokeMessage:(NSString *)conversationID
clientMsgID:(NSString *)clientMsgID
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
conversationID | NSString | Yes | Conversation ID |
clientMsgID | NSString | Yes | Message ID |
Return Result
Name | Type | Description |
---|---|---|
onSuccess | OIMSuccessCallback | Successful return |
onFailure | OIMFailureCallback | Failed return |
Code Example
[OIMManager.manager revokeMessage:@""
clientMsgID:@""
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void revokeMessageV2(OnBase<String> callBack, String conversationID, String clientMsgID)
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
callBack | OnBase<String> | Yes | Callback interface |
conversationID | String | Yes | Conversation ID |
clientMsgID | String | Yes | Message ID |
Code Example
OpenIMClient.getInstance().messageManager.revokeMessageV2(new OnBase<String>() {
public void onError(int code, String error) {
}
public void onSuccess(String data) {
}
}, conversationID, clientMsgID);
// todo
Function Prototype
IMSDK.revokeMessage({
conversationID: string;
clientMsgID: string;
}, operationID?: string): Promise<WsResponse>
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
conversationID | string | Yes | Conversation ID |
clientMsgID | string | Yes | Message ID |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse> | Successful callback |
Promise.catch() | Promise<WsResponse> | Failed callback |
Code Example
import { getSDK } from '@openim/wasm-client-sdk';
const IMSDK = getSDK();
// use in electron with ffi
// import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render';
// const { instance: IMSDK } = getWithRenderProcess();
// use in mini program
// import { getSDK } from '@openim/client-sdk';
// const IMSDK = getSDK();
IMSDK.revokeMessage({
conversationID: '',
clientMsgID: '',
})
.then(({ data }) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
IMSDK.asyncApi('revokeMessage', operationID: string, {
conversationID: string;
clientMsgID: string;
}): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for problem location, recommended to use current time with random number |
conversationID | string | Yes | Conversation ID |
clientMsgID | string | Yes | Message ID |
Return Result
Use the
openim-uniapp-polyfill
package to promise the function. When calling, usethen
andcatch
to determine and handle successful and failed callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Successful callback |
Promise.catch() | Promise<CatchResponse> | Failed callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('revokeMessage', IMSDK.uuid(), {
conversationID: '',
clientMsgID: '',
})
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.revokeMessage({
conversationID: string,
clientMsgID: string,
}, operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
conversationID | string | Yes | Conversation ID |
clientMsgID | string | Yes | Message ID |
operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.revokeMessage({
conversationID: '',
clientMsgID: '',
}, 'operationID')
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
public static void RevokeMessage(OnBase<bool> cb, string conversationId, string clientMsgId)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase | Yes | Callback |
conversationId | string | Yes | Conversation ID |
clientMsgId | string | Yes | Message ID |
Code Example
IMSDK.RevokeMessage((suc ,errCode,errMsg)=>{
}, conversationId, clientMsgId);