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

Unpin a message

Copy link

Sendbird Chat SDK for JavaScript allows you to unpin messages in group channels. Unpinning messages that are no longer relevant or important helps to keep the pinned messages organized in your channel.


Unpinning a message in a channel

Copy link

You can unpin a message using the unpinMessage() method of the GroupChannel class. Specify the messageId of a message to unpin as shown in the code below.

JavaScriptTypeScript
await channel.unpinMessage(pinnedMessage.messageId);

The following table shows a list of properties related to the pinned messages feature. The pinnedMessageIds, and lastPinnedMessage properties belongs to the BaseMessageCreateParams class.

List of properties

Copy link
Property nameTypeDescription

pinnedMessageIds

number[]

Specifies an array of message IDs of the pinned messages in a group channel.

lastPinnedMessage

BaseMessage

Specifies the last message that was pinned in a group channel.

Getting notified when a message is unpinned

Copy link

Once a message is unpinned, the onPinnedMessageUpdated(channel: GroupChannel) event handler is invoked. For further information on GroupChannelHandler, see the Add or remove a channel event handler page.