Pinned messages
Confused about "Pinned messages"?
Let us know how we can improve our documentation:
Pinned messages allow users to highlight important messages, make announcements, or temporarily promote content. Pinning a message is, by default, restricted to certain user roles, but this is flexible. Each channel can have multiple pinned messages and these can be created or updated with or without an expiration.
Pin and unpin a message
Copied!Confused about "Pin and unpin a message"?
Let us know how we can improve our documentation:
An existing message can be updated to be pinned or unpinned by using the .pinMessage
and .unpinMessage
methods. Or a new message can be pinned when it is sent by setting the pinned
and pin_expires
fields when using channel.sendMessage
.
name | type | description | default | optional |
---|---|---|---|---|
pinned | boolean | Indicates whether the message is pinned or not | false | ✓ |
pinned_at | string | Date when the message got pinned | - | ✓ |
pin_expires | string | Date when the message pin expires. An empty value means that message does not expire | null | ✓ |
pinned_by | User | The user that pinned the message | - | ✓ |
PinMessage
permission. You can find the list of permissions and defaults in Permission Resources and Default Permissions sectionsRetrieve pinned messages
Copied!Confused about "Retrieve pinned messages"?
Let us know how we can improve our documentation:
You can easily retrieve the last 10 pinned messages from the channel.pinned_messages
field:
Paginate over all pinned messages
Copied!Confused about "Paginate over all pinned messages"?
Let us know how we can improve our documentation:
Stream Chat also provides dedicated endpoint for pinned messages of the channel which can be used to retrieve all pinned messages page by page: