/ SDKs / iOS
Chat SDKs iOS v4
Chat SDKs iOS
Chat SDKs
Version 4

List pinned messages

Copy link

To retrieve all the pinned messages in a group channel, use PinnedMessageListQuery.

First, create a PinnedMessageListQueryParams object. This query params contains booleans that determine which additional information to include in the pinned message payloads. For example, if a pinned message is a child message in a message thread, set includeParentMessageInfo to true in the params to show its parent message information in the message payload.

Once the query params is set, pass it to the createPinnedMessageListQuery() method to create a query. This query retrieves a list of pinned messages with relevant information specified in the PinnedMessageListQueryParams params.

// Create a params for PinnedMessageListQuery.
let params = PinnedMessageListQueryParams { params in
    params.limit = 50
    // Configure which information to include in the message payloads.
    params.includeMetaArray = true
    params.includeReactions = true
    params.includeParentMessageInfo = true
    params.includeThreadInfo = true
    params.includePollDetails = true

self.query = channel.createPinnedMessageListQuery(params: params)

// Retrieve pinned messages.
self.query?.loadNextPage { messages, error in
    if error != nil {
        // Handle error