Skip to main content
Let users mark messages for later: pin a message so everyone in the conversation sees it, or save one privately for yourself.

Overview

Pin and save look alike in the action sheet but behave differently: With the iOS UI Kit you get: the action-sheet options, pin and bookmark indicators on the bubble, and two full-screen list surfaces.

Prerequisites

  1. Completed Getting Started setup
  2. CometChat UIKit v5+ installed
  3. User logged in with CometChatUIKit.login()
  4. Pin and save enabled for your app

Components

Integration Steps

Step 1: Turn the Features On

Both features are off by default. Nothing appears in the action sheet until you opt in.
Two switches must both be on. enablePinMessage is your app-side opt-in; the feature must also be enabled for your CometChat app, which the kit checks via CometChat.isPinMessageEnabled(). If the options do not appear, this is almost always why.
You can verify the server-side flag directly:

Step 2: Find the Options

Long-press a message to open the action sheet. Pin and save sit behind a “More…” row, which keeps the sheet from overflowing on smaller screens. Tapping it swaps the list, and tapping it again goes back. To change which options live behind that row, edit MessageOptionConstants.overflowOptionIds:
Pinning shows a confirmation first, because it changes what everyone in the conversation sees. Saving applies immediately — it is private and one tap to undo.

Step 3: Add the Pinned Messages Screen

Pinned messages belong to one conversation, so open this from that conversation — typically the message header’s overflow menu.
See Pinned Messages for the full component reference.

Step 4: Add the Saved Messages Screen

Saved messages span every conversation, so this one belongs in your app’s chrome — a tab, the chats-screen menu, or a profile entry. It takes no user or group.
If you push this screen from a tab that hides the navigation bar, set hideNavigationBar = false or the title and back button never appear. Do not also set hideBackButton = false — the component supplies its own chevron, so clearing that flag renders two back buttons.
Because a saved row can come from any chat, onMessageClicked has to resolve the conversation — see Saved Messages for that snippet.

Step 5: Handle Errors

Failures roll the change back automatically and show a message. To react yourself, listen for the error codes on PinSaveErrorCodes:
Always read the cap from errorParams["limit"]. The limit is server-owned and hard-coding it means your copy goes stale the moment it changes.

Customization Options

Who Can Pin

Pinning is gated by role, not authorship — a moderator can pin someone else’s message, and a participant cannot pin their own. The kit uses GroupMembersUtils.allowPinMessage(group:): Saving has no role gate — anyone can save anything they can see. Use the same check to hide the unpin action for users who cannot pin:

Hiding Individual Options

enable* turns the feature on; hide* suppresses one option independently.

Styling

Both screens take their own style object built from theme tokens:

Reacting to Pin and Save Elsewhere

Conform to CometChatMessageEventListener to update your own UI when the local user pins or saves:
All listener methods have default empty implementations, so you only implement the ones you need. See Events.

Edge Cases

Error Handling

Feature Matrix

Chat SDK: Pin & Save

The underlying SDK methods and message fields

Core Features

Overview of messaging features