getGroupHistoryMessageList

Introduction

Load the history message list for group chat, especially for those sent before entering the group chat.

When the network is available, the latest cloud data will be pulled; while it is unavailable, the SDK will return the locally stored historical messages.

Only the historical messages of meeting groups (Meeting) can be pulled. For more information on group message limits, see Group System.

This API does not apply to audio-video groups (AVChatRoom), as their messages are not stored on the cloud roaming server or in the local database.

Extending the storage period of historical messages is a value-added service. You can log in to the IM console to modify the relevant configuration. For billing details, see Pricing.

Rich media messages (such as images, files, and audios) have the same storage periods as historical messages.

Message Storage Policy

FAQs

Parameter details

Parameter name Parameter type Required Description
groupID string yes The group ID.
count number yes The amount of the messages loaded once a request, do not set it so large that might affect the speed of processing.
lastMsgID string no The starting point of loading messages, it will start from the latest message, if not provided.

Returned template

V2TimValueCallback<V2TimMessage[]>

{
    code : number
    desc : string
    data : V2TimMessage[]
}

Return value details

name type description
code number Request result: Error codes. 0 means success.
desc string The description of the error. It will be empty if success.
data V2TimMessage[] The list of messages received.

Code example

import { TencentImSDKPlugin } from 'react-native-tim-js';

const getGroupHistoryMessageListRes = await TencentImSDKPlugin.v2TIMManager
    .getMessageManager()
    .getGroupHistoryMessageList(
        'groupID',
        10
    );
if (getGroupHistoryMessageListRes.code == 0) {

}

results matching ""

    No results matching ""