/ SDKs / Android
SDKs
Chat SDKs Android v4
Chat SDKs Android
Chat SDKs
Android
Version 4

List replies in a message thread

Copy link

You can retrieve replies to a message by identifying the parent message like the following. First, create a ThreadMessageListParams object and set properties related to the thread where the target replies belong to.

// Create a ThreadMessageListParams object.
val params = ThreadMessageListParams().apply {
    previousResultSize = PREV_RESULT_SIZE
    nextResultSize = NEXT_RESULT_SIZE
    inclusive = INCLUSIVE
    reverse = REVERSE
    messagePayloadFilter = MessagePayloadFilter().apply {
        includeThreadInfo = INCLUDE_THREAD_INFO
        includeParentMessageInfo = INCLUDE_PARENT_MESSAGE_INFO
    }
}

ThreadMessageListParams

Copy link
Property nameTypeDescription

previousResultSize

int

Specifies the number of messages to retrieve that were sent before the specified timestamp.

nextResultSize

int

Specifies the number of messages to retrieve that were sent after the specified timestamp.

inclusive

boolean

Determines whether to include the messages with the matching timestamp in the result.

reverse

boolean

Determines whether to sort the retrieved messages in reverse order. If set to false, the result is displayed in ascending order.

includeThreadInfo

boolean

Determines whether to include information about the message thread in the result.

includeParentMessageInfo

boolean

Determines whether to include information about the parent message in the result. (Default: false)

Using the timestamp of the parent message, you can retrieve the parent message with its replies by passing a ThreadMessageListParams object as an argument to the parameter in the getThreadedMessagesByTimestamp() method.

KotlinKTX
parentMessage.getThreadedMessagesByTimestamp(ts, params) { parentMessage, messages, e ->
    if (e != null) {
        // Handle error.
    }

    // A list of replies of the specified parent message timestamp is successfully retrieved.
    // ...
}

List of parameters

Copy link
Parameter nameTypeDescription

ts

long

Specifies the timestamp to be the reference point of message retrieval in Unix milliseconds format.