AI Integration Quick Reference
AI Integration Quick Reference
Conversation object includes the other participant (user or group), the last message, unread counts, and optional tags. Use this to build a Recent Chats list.
Retrieve List of Conversations
UseConversationsRequest with ConversationsRequestBuilder to fetch conversations with various filters.
Set Limit
Set the number of conversations to fetch per request. Maximum is 50.Set Conversation Type
Filter by conversation type:.user for one-on-one or .group for group conversations. If not set, both types are returned.
- Swift (User)
- Swift (Group)
With User and Group Tags
UsewithUserAndGroupTags(true) to include user/group tags in the response. Default is false.
Set User Tags
Fetch user conversations where the user has specific tags.Set Group Tags
Fetch group conversations where the group has specific tags.With Tags
UsewithTags(true) to include conversation tags in the response. Default is false.
Set Tags
Fetch conversations that have specific tags.Include Blocked Users
With Blocked Info
Search Conversations
Search conversations by user or group name.Conversation & Advanced Search is available on Advanced and Custom plans. Enable it from the CometChat Dashboard under Chats → Settings → General Configuration.Unread Conversations
Conversation & Advanced Search is available on Advanced and Custom plans. Enable it from the CometChat Dashboard under Chats → Settings → General Configuration.Fetch Conversations
After configuring the builder, callbuild() to create the request, then fetchNext() to retrieve conversations. Call fetchNext() repeatedly on the same object to paginate.
- Swift (User)
- Swift (Group)
Conversation object consists of the following fields:
Tag Conversation
UsetagConversation() to add tags to a conversation.
Tags for conversations are one-way. If user A tags a conversation with user B, that tag applies only for user A.
Retrieve Single Conversation
UsegetConversation() to fetch a specific conversation.
- Swift (User)
- Swift (Group)
Convert Messages to Conversations
UsegetConversationFromMessage() to convert a received message into a Conversation object. Useful for updating your Recent Chats list when receiving real-time messages.
When converting a message to a conversation,
unreadMessageCount and tags won’t be available. Manage unread counts in your client-side code.Next Steps
Delete Conversation
Remove conversations from the logged-in user’s list
Receive Messages
Listen for incoming messages to update conversation lists in real time
Typing Indicators
Show real-time typing status in conversations
Delivery & Read Receipts
Track message delivery and read status per conversation