AI Integration Quick Reference
AI Integration Quick Reference
Available from UI Kit v6.1.1. These features require
cometchat_chat_uikit v6.1.1 or later, which depends on cometchat_sdk v5.0.7.Overview
Three related features help users keep track of what matters:
The options, toasts and indicators are built into the UI Kit components. The integration work is wiring the two screens into your navigation and jumping to a message when a row is tapped.
Prerequisites
- A working message view — see Getting Started.
- The features enabled for your app. The kit reads each flag at login and hides the matching options when it is off; check them yourself before showing your own entry points:
- Dart
Pin & Save in the Message List
With the features enabled, CometChatMessageList adds Pin message / Unpin message and Save message / Unsave message to the action menu of any sent, non-deleted message. The labels follow the message’s current state.- Pin permission is enforced by the server, not the UI Kit: the option is shown to every participant, and a user who lacks permission gets a “You don’t have permission to perform this action.” toast when they tap it. Build custom pin UI the same way — show the action and handle the denial, rather than trying to predict the verdict client-side.
- Save has no role gate — every user can save any message they can read.
- All four actions apply immediately and show a toast (Message pinned, Message saved, …). When a cap is reached, the toast names the limit from the server’s response.
- Pinned and saved messages show a pin or bookmark glyph before the bubble’s timestamp, updated live.
Step 1: Open Pinned Messages from the Chat Header
CometChatMessageHeader has a built-in Pinned Messages entry in its ⋯ overflow menu, shown whenever Pin Message is enabled. PassonPinnedMessageItemTap so a tapped row can jump the list:
- Dart
Navigator. Tapping a row pops the screen and calls onPinnedMessageItemTap, and jumpToMessage scrolls to the message and highlights it, fetching the page around it first if needed. To present the list yourself — in a side panel on desktop, say — set onPinnedMessagesTap and call CometChatPinnedMessages.show() or embed the widget.
Step 2: Open Saved Messages from Your App Chrome
Saved messages are user-level, so the entry point belongs in app chrome — a profile or user menu on the conversations screen, a settings row, or a navigation tab — not inside a single chat. The kit does not add one:- Dart
Open a Saved Message
Because rows span conversations, opening a tapped message means resolving its conversation first. For a one-on-one message, the counterpart is the sender when someone else sent it and the receiver when the logged-in user did:- Dart
ChatScreen stands for your own messages screen: pass goToMessageId through to CometChatMessageList so it scrolls to the message when it mounts. If the conversation is already open, call jumpToMessage on its CometChatMessageListController instead.
Pin Conversations
With the feature enabled, CometChatConversations adds Pin / Unpin to the long-press menu, shows a pin icon on pinned rows, and keeps pinned conversations at the top of the list — including when new messages arrive. No wiring is required; to hide the option:- Dart
Live Updates
All surfaces stay in sync through the UI Kit event bus and the SDK listeners — pinning from the action menu updates the bubble glyph and the Pinned Messages screen without a refetch, pins made by other members arrive throughonMessagePinned, and saves made on the user’s other devices arrive through onMessageSaved. If you build custom UI, listen for ccMessagePinned / ccMessageUnpinned / ccMessageSaved / ccMessageUnsaved on CometChatMessageEvents; see Events.
Summary / Feature Matrix
Next Steps & Further Reading
- Pinned Messages · Saved Messages — component references.
- Pin A Message · Save A Message · Pin A Conversation — the SDK APIs underneath.