AI Integration Quick Reference
AI Integration Quick Reference
Overview
- The message list raises a callback when someone taps N replies under a message or chooses Reply in thread from its menu.
- Your thread screen shows the parent in
CometChatThreadHeader, the replies inCometChatMessageListgiven the parent, and aCometChatMessageComposergiven the parent’s id. - Replies, edits, reactions and receipts update live on both screens.
Prerequisites
- The Kit is installed, initialised and a user is logged in — see Getting Started.
- A chat screen that already shows
CometChatMessageListfor a user or a group.
Components
Integration Steps
Step 1: Open the thread from the message list
Handle the thread callback on the chat screen and navigate to your thread screen with the parent message.Step 2: Build the thread screen
Show the list in thread mode, with the thread header and the composer replying in the thread as bars over it, hosted as Conversation List + Message View hosts the chat’s, so the rows pass under the bars. Pass the same user or group the chat uses: the list and the composer need the chat as well as the parent.- SwiftUI
- UIKit
ChatView.swift
The thread header fetches nothing — hand it the parent you already hold. It is at most
250 pt tall (
maxHeight); a taller parent scrolls inside it.Step 3: Handle a blocked user
In a one-to-one thread, the composer stays on screen when you have blocked the other person. Put your own banner in its place:- SwiftUI
- UIKit
Thread Subscription
Following a thread is on by default. A user who follows a thread is notified of its replies; the server also subscribes people who start, reply in, or are mentioned in a thread. The Kit ships two controls for the same state, kept in sync:- Subscribe to thread / Unsubscribe from thread in the message list’s long-press menu.
- A bell on the thread header’s reply bar.
CometChatThreadSubscription, so a change made in one place shows in the
other, and in any control of yours that uses it.
Hide the menu option
- SwiftUI
- UIKit
Hear the bell, or hide it
The callback hears the new state once the server accepts it. A failed toggle shows a toast and calls nothing.- SwiftUI
- UIKit
Your own control
UseCometChatThreadSubscription so your control follows the Kit’s rules — one toggle per
thread at a time, and every surface updated at once:
toggle returns nil — and does nothing — while a toggle for the same thread is in flight
or ran in the last 400 ms.
CometChatSession.initialize(appID:region:subscribePresenceForAllUsers:enableThreadSubscription:)
turns the feature off app-wide. It is deprecated — passing true does nothing — and kept only
as that opt-out; prefer hiding the two controls per screen.Implementation Flow
- The user taps N replies or chooses Reply in thread.
- The list calls your handler with the parent message.
- Your thread screen shows the parent, the replies and a composer bound to the thread.
- A sent reply appears in the thread, the reply count goes up, and the sender now follows the thread.
Edge Cases
Feature Matrix
Next Steps
Thread Header
Every option of the parent-message strip
Message List
Thread mode, options and callbacks
Events
The thread family of events
All Guides
Browse the other guides