TIMMsgDelete
Introduction
Delete message
Deleting a message from the cloud:
This API deletes messages both locally and from the cloud, which cannot be recovered.
Up to 30 messages can be deleted per call.
Messages to be deleted per call must be from the same conversation.
This API can be called only once per second.
If messages have been pulled on a device by an account, they will remain on the device after the API is called to delete them from the cloud; in other words, deleted messages are not synced.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
msgDeleteParams | MsgDeleteParams | yes | Param of deleting message |
Returned template
Promise<commonResult<string>>
{
code: TIMResult | TIMErrCode;
desc?: string | undefined;
json_param?: string | undefined;
json_params?: string | undefined;
user_data?: string | undefined;
}
Return value details
name | type | description |
---|---|---|
code | TIMResult | TIMErrCode | Request result: Error codes. 0 means success. |
desc | string | undefined | The description of the error. It will be empty if success. |
json_param | string | undefined | Return value of calling API |
json_params | string | undefined | Return value of calling API. Compatible field, which is returned in some cases. |
user_data | string | undefined | ImSDK is responsible for transporting user-defined data without any processing |
Code example
import TimRender from "im_electron_sdk/dist/renderer";
const timRenderInstance = new TimRender();
import { MsgDeleteParams,Json_value_msgdelete,MsgGetMsgListParams,Json_value_msg } from "im_electron_sdk/dist/interfaces";
let convId = ''
let convType=0
let param2:MsgGetMsgListParams = {
conv_id:convId,
conv_type: convType,
params: {
msg_getmsglist_param_last_msg: null,
msg_getmsglist_param_count: 2,
msg_getmsglist_param_is_ramble: true,
},
user_data: ""
}
let m = await timRenderInstance.TIMMsgGetMsgList(param2);
let json_msg_param:Json_value_msg = m.json_params[0];
let params: Json_value_msgdelete = {
msg_delete_param_msg: json_msg_param,
msg_delete_param_is_ramble: true // optional
}
let param: MsgDeleteParams = {
conv_id: convId,
conv_type: convType,
params: params,
user_data: ''
}
const { code } = await timRenderInstance.TIMMsgDelete(param);
if (code == 0) {
// success
}