Pin a message
- The table below shows the types of channels that support pinned messages. See the channel types section to learn about the differences among various channel types.
|Open channel||Group channel||Supergroup channel|
Supported, except ephemeral channels
- Pinned messages can't be sent as silent messages. The
silentproperty should be set to
falsewhen pinning or unpinning messages.
Pinning a message on send
You can pin a new message that you're sending in a channel by setting the
isPinnedMessage property to
true. This property belongs to the
BaseMessageCreateParams class. The default value for this property is
false, meaning that the message being sent is not automatically pinned unless specified.
Pinning an existing message
You can pin a message, that is already sent in a channel, using the
pinMessage() method of the
GroupChannel class. Specify the
messageId of a message to pin as shown in the code below.
Note: A group channel has to be created before implementing the code below.
The following table shows a list of properties related to the pinned messages feature. The
lastPinnedMessage properties belong to the
List of properties
Specifies an array of message IDs of the pinned messages in a group channel.
Specifies the last message that was pinned in a group channel.
Getting notified when a message is pinned
Once a pinned message is sent or an existing message is pinned, the
onPinnedMessageUpdated(channel: GroupChannel) event handler is invoked. For further information on
GroupChannelHandler, see the Add or remove a channel event handler page.