Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sceyt/sceyt-chat-android-uikit/llms.txt

Use this file to discover all available pages before exploring further.

MessageInteractor is the primary interface for all message-level operations in the Sceyt Chat Android UIKit. It is accessible via SceytChatUIKit.chatUIFacade.messageInteractor. Nearly all methods are suspend functions. Paginated loading methods return Flow<PaginationResponse<SceytMessage>>, which emits a database result first and then updates from the server. One-shot operations return SceytResponse<T> — a sealed class with Success and Error variants. Thread replies are supported throughout by passing replyInThread = true and using the parent message ID as the conversationId. Package: com.sceyt.chatuikit.persistence.interactor
val interactor: MessageInteractor = SceytChatUIKit.chatUIFacade.messageInteractor

Loading Messages

loadPrevMessages
suspend fun → Flow<PaginationResponse<SceytMessage>>
Loads messages older than lastMessageId (backwards pagination). Emits cached messages immediately, then emits the server response once available.
interactor.loadPrevMessages(
    conversationId = channelId,
    lastMessageId  = oldestVisibleMessageId,
    replyInThread  = false,
    offset         = 0,
    limit          = 50,
    loadKey        = LoadKeyData(),
    ignoreDb       = false
).collect { response -> /* render */ }
loadNextMessages
suspend fun → Flow<PaginationResponse<SceytMessage>>
Loads messages newer than lastMessageId (forward pagination). Use this to scroll towards newer messages when the user is not at the bottom of the conversation.
interactor.loadNextMessages(
    conversationId = channelId,
    lastMessageId  = newestLoadedMessageId,
    replyInThread  = false,
    offset         = 0,
    limit          = 50,
    ignoreDb       = false
).collect { response -> /* render */ }
loadNearMessages
suspend fun → Flow<PaginationResponse<SceytMessage>>
Loads messages surrounding a specific messageId — useful for scrolling to a search result or a mention deep inside the history. Fetches both older and newer messages around the anchor.
interactor.loadNearMessages(
    conversationId = channelId,
    messageId      = targetMessageId,
    replyInThread  = false,
    limit          = 50,
    loadKey        = LoadKeyData(),
    ignoreDb       = false,
    ignoreServer   = false
).collect { response -> /* render */ }
loadNewestMessages
suspend fun → Flow<PaginationResponse<SceytMessage>>
Loads the most recent messages in a conversation. Use this as the initial load when opening a channel.
interactor.loadNewestMessages(
    conversationId = channelId,
    replyInThread  = false,
    limit          = 50,
    loadKey        = LoadKeyData(),
    ignoreDb       = false
).collect { response -> /* render */ }

Searching Messages

searchMessages
suspend fun → SceytPagingResponse<List<SceytMessage>>
Performs a full-text search in a conversation. Returns the first page of matching messages. Call loadNextSearchMessages() to paginate through additional results.
val result = interactor.searchMessages(
    conversationId = channelId,
    replyInThread  = false,
    query          = "hello world"
)
loadNextSearchMessages
suspend fun → SceytPagingResponse<List<SceytMessage>>
Loads the next page of results from the most recent searchMessages call. Must be called after searchMessages has returned successfully.
val nextPage = interactor.loadNextSearchMessages()

Unread Mentions

getUnreadMentions
suspend fun → SceytPagingResponse<List<Long>>
Returns a page of message IDs where the current user has been mentioned and has not yet read, relative to messageId in the specified direction.
val mentions = interactor.getUnreadMentions(
    conversationId = channelId,
    direction      = Direction.Prev,
    messageId      = latestReadMessageId,
    limit          = 30
)

Fetching Messages by ID

loadMessagesById
suspend fun → SceytResponse<List<SceytMessage>>
Fetches a specific set of messages from the server by their IDs.
val result = interactor.loadMessagesById(
    conversationId = channelId,
    ids            = listOf(msg1Id, msg2Id)
)
getMessageFromServerById
suspend fun → SceytResponse<SceytMessage>
Fetches a single message from the server by its ID and persists it locally.
getMessageFromDbById
suspend fun → SceytMessage?
Returns a single message from the local database by its server-assigned ID, or null if not found.
getMessageFromDbByTid
suspend fun → SceytMessage?
Returns a single message from the local database by its client-side transaction ID (tid), or null if not found.

Syncing Messages

syncMessagesAfterMessageId
suspend fun → Flow<SyncResult<SceytMessage>>
Fetches all messages sent after messageId from the server and persists them locally. Useful for catching up after an extended offline period.
interactor.syncMessagesAfterMessageId(
    conversationId = channelId,
    replyInThread  = false,
    messageId      = lastKnownMessageId
).collect { syncResult -> /* track progress */ }
syncNearMessages
suspend fun → SyncNearMessagesResult
Synchronises a window of messages around a specific messageId from the server. Returns a SyncNearMessagesResult with the refreshed message set.

Sending Messages

sendMessageAsFlow
suspend fun → Flow<SendMessageResult>
Sends a message and returns a Flow that emits SendMessageResult events tracking the send lifecycle (pending → uploading attachments → sent). Prefer this over sendMessage when you need progress updates.
interactor.sendMessageAsFlow(channelId, message)
    .onEach { result -> /* update UI for pending/sent states */ }
    .launchIn(lifecycleScope)
sendMessage
suspend fun
Fires a message send without returning a flow result. Use for fire-and-forget sending when you don’t need per-message progress feedback.
sendMessages
suspend fun
Sends multiple messages in sequence to a channel. Each message is persisted locally first.
sendSharedFileMessage
suspend fun
Sends a message that originated from the Android share sheet (external file share). Handles the shared file’s upload lifecycle.
sendFrowardMessages
suspend fun → SceytResponse<Boolean>
Forwards one or more existing messages to a channel. The forwarded messages are sent as new messages preserving the original sender attribution.
interactor.sendFrowardMessages(targetChannelId, msg1, msg2)
sendMessageWithUploadedAttachments
suspend fun → SceytResponse<SceytMessage>
Sends a message whose attachments have already been uploaded (i.e. the attachment url is already populated). Use this when you manage uploads externally.

Pending Messages

sendPendingMessages
suspend fun
Retries sending all pending (failed or queued) messages for a specific channel.
sendAllPendingMessages
suspend fun
Retries sending all pending messages across every channel. Called automatically after reconnection.
sendAllPendingMarkers
suspend fun
Flushes all queued read/delivery/played markers that could not be sent while offline.
sendAllPendingMessageStateUpdates
suspend fun
Syncs all pending message state changes (edits, deletes) that were queued during an offline period.
sendAllPendingReactions
suspend fun
Sends all queued reaction add/remove operations that could not be delivered while offline.

Markers

markMessagesAs
suspend fun → List<SceytResponse<MessageListMarker>>
Sends a standard marker (e.g. MarkerType.Displayed, MarkerType.Received) for the specified message IDs.
interactor.markMessagesAs(channelId, MarkerType.Displayed, msg1Id, msg2Id)
addMessagesMarker
suspend fun → List<SceytResponse<MessageListMarker>>
Sends a custom string marker for the specified message IDs. Use this for application-specific receipts beyond the built-in set.

Editing and Deleting

editMessage
suspend fun → SceytResponse<SceytMessage>
Edits an existing message’s body or metadata. Subject to the messageEditTimeout window configured in SceytChatUIKitConfig.
val result = interactor.editMessage(channelId, updatedMessage)
deleteMessage
suspend fun → SceytResponse<SceytMessage>
Deletes a message. The deleteType parameter controls whether the message is deleted only for the current user or for all participants.
interactor.deleteMessage(
    channelId  = channelId,
    message    = messageToDelete,
    deleteType = DeleteMessageType.DeleteForEveryone
)

Channel Events and Live Flow

sendChannelEvent
suspend fun
Sends a transient typing or custom event to the channel. These events are not persisted as messages.
interactor.sendChannelEvent(channelId, event = "typing")
getOnMessageFlow
fun → SharedFlow<Pair<SceytChannel, SceytMessage>>
Returns a hot SharedFlow that emits a (SceytChannel, SceytMessage) pair whenever a new message arrives on any channel. Subscribe at the application level to drive notifications or badge updates.
interactor.getOnMessageFlow()
    .onEach { (channel, message) -> showNotification(channel, message) }
    .launchIn(lifecycleScope)

Build docs developers (and LLMs) love