/ SDKs / JavaScript
SDKs
Chat SDKs JavaScript v4
Chat SDKs JavaScript
Chat SDKs
JavaScript
Version 4

List pinned messages

Copy link

To retrieve all the pinned messages in a group channel, use PinnedMessageListQuery. When creating the query instance through the createPinnedMessageListQuery() method, you can set booleans to determine which additional message information to include in the payloads. For example, if a pinned message is a child message in a message thread, set includeParentMessageInfo to true in the query to show its parent message information in the message payload.

// Configure which information to include in the message payloads.
const query = channel.createPinnedMessageListQuery({
  limit: 50,
  includeMetaArray: true,
  includeReactions: true,
  includeParentMessageInfo: true,
  includeThreadInfo: true,
  includePollDetails: true,
});
// Retrieve pinned messages.
const messages = await query.next();