AI Integration Quick Reference
AI Integration Quick Reference
This is separate from an admin-global pin, which is managed from the
CometChat Dashboard and shows for every user.
Those cannot be created or removed from the SDK, only observed.
Pin a Conversation
A conversation is addressed by its peer — the other user’s UID for a one-on-one conversation, or the GUID for a group — together with the conversation type.- TypeScript (User)
- JavaScript (User)
- TypeScript (Group)
- JavaScript (Group)
Conversation, with pinnedAt and pinnedBy set. Pinning is idempotent.
Unpin a Conversation
- TypeScript
- JavaScript
getPinnedBy() is "app_system".
Fetch Pinned Conversations
The default conversation list is already pin-ordered by the server: admin-global pins first, then the user’s own pins, then everything else. Each row already carriespinnedAt and pinnedBy, so a pinned strip usually needs no separate call.
When you do want the pinned set standalone, use setPinnedBy().
- TypeScript
- JavaScript
These are plain strings in the React Native SDK — there is no
CometChat.PINNED_BY constant to import. The server rejects any other value
with ERR_BAD_REQUEST — end users cannot query another user’s pins — so the
builder drops unrecognised entries before the request is sent.Check if a Conversation is Pinned
As with messages, the React Native SDK has noisPinned() helper — the presence of pinnedAt is the boolean.
- TypeScript
- JavaScript
Keeping the List in Sync
On the device that performed the action, update your list from the Promise. Your own pin or unpin does not fireonConversationPinned / onConversationUnpinned on that device. Those callbacks fire on the user’s other devices when a pin arrives there, so register a ConversationListener to reorder the list without a refetch.
- TypeScript
- JavaScript
- TypeScript
- JavaScript
Pin Limit
- TypeScript
- JavaScript
null when the app settings carry no value. getSystemPinConversationLimit() is the separate admin/global cap, enforced independently — system pins do not consume a user’s allowance.
The conversation pin cap and the message pin cap are separate quotas with
different values, and both are server-owned and tenant-overridable. Read
each one at runtime rather than assuming a number or reusing the other.
Feature Availability
- TypeScript
- JavaScript
false as the normal case for a new app, not as an error.
Offline Behaviour
With offline support enabled, passing aConversationFetchListener to fetchNext() on a setPinnedBy() request calls onCachedConversations first (even when the page is empty) and then onServerConversations with the live list. Offline, the read ends with onError (FAILED_TO_FETCH) after the cached page, and the Promise rejects. onCachedConversations holds the pinned conversations the cache already knows about, in the same order.
Next Steps
Retrieve Conversations
Fetch and order the conversation list
Pin A Message
Highlight a message for everyone in a conversation
Save A Message
Bookmark a message privately, across conversations
Delete A Conversation
Remove a conversation from the list