ChatThreadsHandler

Instance that allows modification, manipulation and observing of threads.

Some methods of this class depend on configuration sent from the server. If the configuration changes remotely, you need to call ChatBuilder.build again and use the newly created instance. The saved configuration will never change at run-time.

There are no effects attached to initialization of this class.

Properties

Link copied to clipboard

A pre-chat form which should be answered by the user before create is called. Answers have to be supplied as custom fields in the create call.

Link copied to clipboard
abstract val threadsFlow: Flow<List<ChatThread>>

A hot Flow that emits the current thread list. Replays the last value to new subscribers.

Functions

Link copied to clipboard

Creates a new thread -if permitted by the configuration- and returns a handler for it. threadsFlow will emit this new instance even if it's not created on the server yet.

open fun create(customFields: Map<String, String>): ChatThreadHandler
open fun create(preChatSurveyResponse: Sequence<PreChatSurveyResponse<out FieldDefinition, out Any>>): ChatThreadHandler
abstract fun create(customFields: Map<String, String>, preChatSurveyResponse: Sequence<PreChatSurveyResponse<out FieldDefinition, out Any>>): ChatThreadHandler

Creates a new thread -if permitted by configuration- and returns a handler for it. threadsFlow will emit this new instance even if it's not created on the server yet.

Link copied to clipboard
abstract fun refresh()

Sends a request to refresh the thread list.

Link copied to clipboard
abstract fun thread(thread: ChatThread): ChatThreadHandler

Creates a new thread handler with given thread. thread is used as a template and this particular instance will not be updated in response to changes in the handler.