ConversationClient

Represents a specific conversation.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val conversation: Flow<Result<Conversation>>

A Flow for observing the current conversation. Result.Success.data returns the conversation.

Link copied to clipboard
abstract val conversationId: UUID

The current conversation ID.

Link copied to clipboard

A Flow of ConversationEvents for this conversationId.

Functions

Link copied to clipboard
abstract suspend fun closeConversation(): Result<Unit>

Permanently closes the conversation. Users will no longer be able to perform any operations on this conversation.

Link copied to clipboard
abstract suspend fun conversationEntries(limit: Int = 100, timestamp: Long? = null, direction: QueryDirection = QueryDirection.Descending, forceRefresh: Boolean = false): Result<List<ConversationEntry>>

Gets the ConversationEntrys scoped to this conversation.

Link copied to clipboard
abstract fun conversationEntriesFlow(limit: Int = 100, timestamp: Long? = null, direction: QueryDirection = QueryDirection.Descending, forceRefresh: Boolean = false): Flow<Result<List<ConversationEntry>>>

Gets the ConversationEntry objects related to this conversation.

Link copied to clipboard
abstract fun conversationEntriesPaged(pageSize: Int = DEFAULT_PAGE_SIZE): Flow<Result<PagingData<ConversationEntry>>>

Gets the ConversationEntrys scoped to this conversation.

Link copied to clipboard
abstract suspend fun createConversation(remoteConfiguration: RemoteConfiguration? = null): Result<Conversation>

Creates a conversation.

Link copied to clipboard
abstract suspend fun currentConversation(): Conversation?

Gets the current Conversation for the ConversationClient.

Link copied to clipboard
abstract suspend fun endSession(): Result<Unit>

End the current session on this conversation.

Link copied to clipboard
abstract suspend fun markAsRead(conversationEntry: ConversationEntry): Result<ConversationEntry>

Sends a read acknowledgement for a ConversationEntry.

Link copied to clipboard
abstract suspend fun retrieveTranscript(): Result<InputStream>

Retrieves a transcript for the current conversation.

Link copied to clipboard
abstract suspend fun retryEntry(conversationEntry: ConversationEntry): Result<ConversationEntry>
abstract suspend fun retryEntry(conversationEntry: ConversationEntry, remoteConfiguration: RemoteConfiguration): Result<ConversationEntry>
abstract suspend fun retryEntry(conversationEntry: ConversationEntry, preChatFields: List<PreChatField> = emptyList(), hiddenPreChatFields: List<PreChatField> = emptyList()): Result<ConversationEntry>

Re-sends a conversation entry.

Link copied to clipboard
abstract suspend fun sendCancel(entry: ConversationEntry): Result<ConversationEntry>

Sends a cancel action referencing a conversation entry.

Link copied to clipboard
abstract suspend fun sendFile(file: File, message: String? = null): Result<ConversationEntry>

Sends an attachment file to a conversation.

Link copied to clipboard

Sends filled out Message.FormMessage.

Link copied to clipboard
abstract suspend fun sendImage(image: File): Result<ConversationEntry>

Sends an image attachment file to a conversation.

Link copied to clipboard
abstract suspend fun sendMessage(message: String): Result<ConversationEntry>

Sends a text message to a conversation.

Link copied to clipboard
abstract suspend fun sendPdf(pdf: File): Result<ConversationEntry>

Sends a PDF attachment file to a conversation.

Link copied to clipboard
abstract suspend fun sendReply(reply: OptionItem): Result<ConversationEntry>

Sends a reply to a structured content message.

Link copied to clipboard
abstract suspend fun sendTypingEvent(): Result<Unit>

Sends a typing event for the current conversation.

Link copied to clipboard

Sets the session context to be sent on the next message sent. Once the message has been sent the sessionContext is cleared.

Link copied to clipboard
abstract suspend fun submitPreChatData(preChatFields: List<PreChatField> = emptyList(), hiddenPreChatFields: List<PreChatField> = emptyList(), createConversationOnSubmit: Boolean = true): Result<Conversation>

Creates a conversation with a dictionary of pre-chat data for routing.

Link copied to clipboard
abstract suspend fun submitRemoteConfiguration(remoteConfiguration: RemoteConfiguration, createConversationOnSubmit: Boolean = true): Result<Conversation>

Creates a conversation with a remote configuration object with routing data and more.