Skip to main content

Goal

By the end of this guide you will have a chat screen where users can pin a message so it’s highlighted for everyone in the conversation, open a screen of all pinned messages, and save a message privately to their own list — with a dedicated “Saved” screen to review saves across every conversation. Pin and save are two separate concepts:

Prerequisites

  • Completed the Integration Guide
  • An existing chat screen using CometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer
  • Pin messages and Save messages enabled for your app through the features.ux.messages.pinned.enabled and features.ux.messages.saved.enabled app settings. See Core Features → Pin & Save.
The pin/unpin and save/unsave options only appear in the message options when the corresponding feature is enabled for your app. The UI Kit reads that setting at login and re-reads it on every reconnection, so no extra wiring is needed to show or hide the options.

Step 1: The Message Options

Once the features are enabled, CometChatMessageList automatically adds Pin, Unpin, Save, and Unsave to the message options — no props required. You only need the hide* props if you want to remove one: File: Messages.tsx
The Pin/Unpin option is shown to every member — the UI Kit does not gate it by role. Permission is enforced by the server: if a member isn’t allowed to pin or unpin in that conversation, the action is rejected and the UI Kit shows a permission toast. Saving is per-user and always available.
The options are hidden on messages the server would refuse anyway — an unsent message with no ID yet, a deleted message, or one still awaiting a moderation verdict. A message sent seconds ago may briefly show no pin or save option while moderation is pending; it appears once the message is approved.

Step 2: Open the Pinned Messages Screen

CometChatMessageHeader can show a pinned-messages button. Set showPinnedMessagesButton and wire onPinnedMessagesPress to navigate to CometChatPinnedMessages, scoped to the same user/group. File: Messages.tsx
File: PinnedMessages.tsx
CometChatPinnedMessages is per conversation — it takes the same user or group the chat screen was opened with, and lists that conversation’s pinned messages newest-pin first.
The Pinned Messages screen listing one conversation's pinned messages as full bubbles, each with a pin glyph beside its timestamp.

Step 3: Add a “Saved” Screen

CometChatSavedMessages is user-level, not per conversation — it lists everything the logged-in user has saved, across every chat. There is no built-in entry point, so open it from your own navigation: a menu item, a profile screen, or a tab.
The Saved Messages screen listing saved messages from across every conversation, each row showing its source conversation and a one-line preview.
File: SavedMessages.tsx
Each row shows which conversation the message came from, so a saved message is never orphaned from its context. source carries that conversation as receiverType ("user" or "group") and receiverId, plus name, label and an optional avatar — see the component reference.

Step 4: Pinned & Saved Indicators

No wiring needed. CometChatMessageList renders a pin glyph and a filled bookmark in the message’s meta row, beside the timestamp, and keeps them in sync in real time:
  • Pin is conversation-wide, so every participant sees the indicator appear and disappear as the message is pinned or unpinned.
  • Save is private, so the indicator appears only for the user who saved it — and syncs to that user’s other devices.

Step 5: Limits

Both features are capped by the server, per app: When a cap is reached, the action is rejected and the UI Kit shows a toast carrying the server-provided limit — the number is never hard-coded in the kit, so raising the cap for your app changes the message automatically.

Complete Example

File: Messages.tsx
goToMessageId is what makes the jump actually happen: CometChatMessageList fetches the page around that ID and scrolls to it, so tapping a pinned or saved row lands on the message in its original conversation.

Next Steps