Available from Chat SDK v4.1.9. These APIs require
CometChatSDK v4.1.9 or later.AI Integration Quick Reference
AI Integration Quick Reference
Pin a Message
Pinning is conversation-wide: every participant sees the message as pinned.- Swift
Pinning is permission-gated. In a group, only the owner, admins and moderators can pin or unpin; everyone can view the pinned list. In one-to-one conversations both participants can pin.
Unpin a Message
- Swift
Save a Message
Saving is private to the logged-in user and syncs across that user’s own devices. It carries no permission checks.- Swift
Unsave a Message
- Swift
BaseMessage.
Message Fields
Three fields onBaseMessage carry the state:
- Swift
Fetch Pinned Messages
Pinned messages are fetched withMessagesRequest filtered by pinned, scoped to a conversation with uid or guid.
- Group
- One-to-one
Fetch Saved Messages
Saved messages are a per-user collection spanning every conversation, so the request takes nouid or guid.
- Swift
Both limits are capped at 100 server-side, so a single page fetches the whole list.
Real-time Events
ImplementCometChatMessageDelegate to receive pin and save updates. All four callbacks are optional and each carries the full updated message.
- Swift
Your own pin, unpin, save or unsave is reported through its
onSuccess closure only. It does not fire onMessagePinned, onMessageUnpinned, onMessageSaved or onMessageUnsaved on the device that made the change, so update your UI from onSuccess.
Feature Availability
Both features are gated per app and can be checked before showing any UI:- Swift
Error Handling
CometChatException carries an optional errorParams dictionary holding structured, machine-readable details the server sent alongside the error — so you can react to an error programmatically instead of parsing errorDescription.
- Swift
errorParams rather than hard-coding a number — the limit is server-owned and may change.
errorParams is [String: Any]? and is therefore not exposed to Objective-C. It is nil when the server sent no structured details, so always unwrap it.