getHistoryMessageList

Introduction

[Recommend]: The advanced method to load the history message list.

Locally stored historical messages are not subject to time limits, but those stored in the cloud are subject to the following time limits:

Trial edition: The free storage period is 7 days and cannot be extended.

Pro edition: The free storage period is 7 days and can be extended.

Ultimate edition: The free storage period is 30 days and can be extended.

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.

In addition to load historical one-to-one and group messages, this API supports the following advanced features:

  1. Set the source for message loading: loading from the local database or the cloud.

  2. Specify the sequence for message load: loading in reverse chronological order or in chronological order

  3. Specify the message type for local load: text, image, audio, video, file, emoji, group tip, merged, or custom message

For details, you can referring to this document.

Message Storage Policy

FAQs

Parameter details

Parameter name Parameter type Required Platform Description
getType HistoryMsgGetTypeEnum no All Source and sequence of the message loading, which can be set to local/cloud and reverse chronological order/chronological order respectively.
userID String no All The specified user ID with which to load historical one-to-one messages.
groupID String no All The specified group ID with which to load historical group messages.
lastMsgSeq int no All Sequence of the last message, indicating the message starting from which to load historical messages
count int yes All The amount of the messages loaded once a request, do not set it so large that might affect the speed of processing. But, on Web, it can not be larger than 15.
lastMsgID String no All ID of the last message, indicating the message starting from which to load historical messages
messageTypeList List< int > no All To specify which types of messages to load, for details, see MessageElemType.

Returned template

V2TimValueCallback<List<V2TimMessage>>

{
    code : int
    desc : String
    data : List<V2TimMessage>
}

Return value details

name type description
code int Request result: Error codes. 0 means success.
desc String The description of the failure.
data List< V2TimMessage > The list of messages received.

Code example

    V2TimValueCallback<List<V2TimMessage>> getHistoryMessageListRes =
        await TencentImSDKPlugin.v2TIMManager
            .getMessageManager()
            .getHistoryMessageList(
      getType: HistoryMsgGetTypeEnum.V2TIM_GET_LOCAL_OLDER_MSG, 
      userID: "userID", 
      groupID: "groupID", 
      count: 10, 
      lastMsgID: null, 
      lastMsgSeq: -1,
      messageTypeList: [], 
    );
    if (getHistoryMessageListRes.code == 0) {
    }

results matching ""

    No results matching ""