Skip to main content
Pin a message to keep it at hand for everyone in the conversation; save a message to keep a private bookmark across all your conversations; pin a conversation to keep it at the top of the list. The message list’s menu does the pinning and saving — this guide adds the screens that show the results.

Overview

Prerequisites

  • The Kit is set up and a user is logged in — see Getting Started.
  • Pinned and saved messages are switched on for your app in the CometChat dashboard. The Kit reads the switches through CometChatSession.isPinMessageEnabled() and CometChatSession.isSaveMessageEnabled(); with a switch off, its options and screens do not appear.

Pin & Save in the Message List

Nothing to wire: CometChatMessageList adds Pin / Unpin and Save / Unsave to a message’s long-press menu when the feature is on. Pinning puts a pin mark on the bubble; both announce themselves on the event bus, so every other surface updates.

Step 1: Open Pinned Messages from the Chat Header

Turn on the header’s pinned-messages entry and open CometChatPinnedMessages for the same chat. When the user taps a pinned message, close the screen and jump the list to it.
ChatView.swift
For a group chat pass the group — CometChatPinnedMessages(group:) — not the user. Host the header and the composer over the list as Conversation List + Message View shows.

Step 2: Open Saved Messages from Your App Chrome

Saved messages belong to the user, not to one chat, so open the screen from your own chrome — a profile menu, a settings row. A tap hands you the message; open its conversation there.
A saved message’s conversation is its group when receiverType is .group; otherwise it is the other person — the receiver when you sent it, the sender when you did not. Open that chat and jump to the message as in Step 1.

Pin Conversations

CometChatConversations shows Pin / Unpin in a row’s swipe actions and long-press menu when the feature is on for your app. Pinning happens at once; unpinning asks first. A pinned row stays above the rest. A conversation an administrator pinned shows no unpin — the server refuses it.

Limits and Errors

The caps — pins per conversation, saves per user, pinned conversations per user — are app settings. When a user hits one, the Kit shows a toast that names the limit; you handle nothing. If you build your own pin or save control on the SDK, handle these codes:

Live Updates

Pinning, unpinning, saving and unsaving through the Kit are announced on the event bus, so the bubble’s pin mark, Pinned Messages and Saved Messages stay in step without a refetch. For your own UI, listen to them:

Feature Matrix

Next Steps

Pinned Messages

The pinned-messages screen in full

Saved Messages

The saved-messages screen in full

Message Header

The header’s options and entries

All Guides

Browse the other guides