AI Integration Quick Reference
AI Integration Quick Reference
Overview
CometChatPinnedMessages renders the messages pinned in a single conversation. Scope it to a user or a group, and it fetches that conversation’s pins, keeps them in sync as messages are pinned and unpinned in real time, and surfaces per-message actions (unpin, save, copy, info, and more). It is typically mounted as a panel that opens from the Message Header’s pinned-messages action.
Live Preview — interact with the default pinned messages panel.Open in Storybook ↗
The component handles:
- Fetching the conversation’s pinned messages
- Real-time updates when a message is pinned or unpinned
- An overflow menu of per-message options (unpin, save, copy, info, and more)
- Empty, loading, and error states
Pinning must be enabled for your app through the
features.ux.messages.pinned.enabled app setting for pins to load. See Core Features.Usage
Flat API
Pass theuser or group whose pins you want to show.
Compound Composition
For full layout control, compose the sub-components underRoot. Omit any sub-component to drop it.
Opening from the Message Header
Wire the panel to the header’s pinned-messages action withonPinnedMessagesClicked. See the Pin & Save Messages guide for the full screen.
Filtering
Pass amessagesRequestBuilder to control which pinned messages are fetched — for example, to change the page size. Call setPinned(true) on the builder: it is what scopes the request to pinned messages, and without it the request is an ordinary history read.
The component re-asserts
setPinned(true) and the user/group conversation scope on whatever builder you pass, so those are safe even if you omit them — but keep setPinned(true) in your code to make the intent explicit. Don’t set a different conversation scope on the builder.Actions and Events
Callback Props
Events
The component itself publishes nothing, but the per-message actions it renders (through the shared message options) publish UI events — such asui:message/pin-changed and ui:message/save-changed — that keep other surfaces in sync.
It subscribes to the kit event bus and updates its list automatically. Each pin/save has two events: an optimistic ui: flip fired the moment the action succeeds locally, and the network-confirmed SDK event that follows:
See the Event System for the full list.
Customization
Per-message Options
Each pinned row exposes its actions in an overflow menu, with the first few surfaced inline as quick actions. Use thehide* props to trim the menu:
quickOptionsCount:
View Props
Replace parts of the UI while keeping the component’s behavior:Compound Composition
Use sub-components for full layout control:CSS Styling
Override design tokens on the component selector:Props
Provide eitheruser or group (not both). All other props are optional.
View slot props (
itemView, headerView, emptyView, errorView, loadingView) are convenience props on the flat API. In compound composition mode, use the corresponding sub-components directly.user
The 1:1 conversation whose pinned messages to show. Mutually exclusive withgroup.
group
The group conversation whose pinned messages to show. Mutually exclusive withuser.
messagesRequestBuilder
Customize the request used to fetch pinned messages (for example, the page size).quickOptionsCount
How many per-message actions to show inline on a row before the rest collapse into the overflow menu.textFormatters
Text formatters applied when rendering the pinned message previews. See Text Formatters.hideCloseButton
Hide the close button in the panel header.hideUnpinMessageOption
Remove the unpin action from the per-message options.hideSaveMessageOption / hideUnsaveMessageOption
Remove the save / unsave actions from the per-message options.hideCopyMessageOption
Remove the copy action from the per-message options.hideMessageInfoOption
Remove the message-info action from the per-message options.hideFlagMessageOption
Remove the flag action from the per-message options.hideMessagePrivatelyOption
Remove the “message privately” action from the per-message options.hideTranslateMessageOption
Remove the translate action from the per-message options.onItemClick
Callback when a pinned row is clicked.onClose
Callback when the close button is clicked.className
Additional CSS class for the root element.CSS Selectors
Next Steps
Pin & Save Messages Guide
Build a full pin/save screen end to end
Saved Messages
The user’s saved messages across conversations
Message Header
Open the pinned-messages panel from the header
Message List
Toggle the pin/unpin message options