TIMMsgBatchSend

Introduction

Send batch messages

Batch send message, each msg_batch_send_param_identifier_array's sending result will be informed by callback.

Parameter details

Parameter name Parameter type Required Description
msgBatchSendParams MsgBatchSendParams yes Param of sending batch messages

Returned template

Promise<commonResult<Array<BatchSendResult>>>

{
    code: TIMResult | TIMErrCode;
    desc?: string | undefined;
    json_param?: Array<BatchSendResult> | undefined;
    json_params?: Array<BatchSendResult> | undefined; 
    user_data?: string | undefined;
}

Return value details

name type description
code TIMResultTIMErrCode Request result: Error codes. 0 means success.
desc string | undefined The description of the error. It will be empty if success.
json_param Array< BatchSendResult > | undefined Return value of calling API
json_params Array< BatchSendResult > | 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 { MsgBatchSendParams } from "im_electron_sdk/dist/interfaces";
let userId = ''
let param: MsgBatchSendParams = {
    params: {
        msg_batch_send_param_identifier_array: [userId],
        msg_batch_send_param_msg: {
            message_elem_array: [{
                elem_type: 3,
                text_elem_content: ""
            }],
            message_sender: ""
        }
    },
    user_data: ""
}

const { code } = await timRenderInstance.TIMMsgBatchSend(param);
if (code == 0) {
    // success
}

results matching ""

    No results matching ""