EntryPoint

interface EntryPoint

Public interface defining the Kindly Chat SDK API. Use ChatKindlySDK (aliased as KindlySDK) to access the implementation.

Inheritors

Properties

Link copied to clipboard
abstract var config: KindlySDKConfig

The SDK configuration for permissions and theme settings.

Link copied to clipboard

Whether the SDK should send crash reports via Sentry. Defaults to true.

Link copied to clipboard
abstract val events: Flow<KindlyEvent>

Unified event flow for all Kindly events (matches web API pattern) Subscribe to this to receive all events: load, message, buttonClick, ui, state

Link copied to clipboard

Optional delegate for receiving button press and link interception callbacks.

Link copied to clipboard
abstract val state: Flow<KindlyEventState>

Unified state flow that emits state change events Subscribe to this to get real-time updates of: isChatDisplayed, isConnected, isStarted, isSocketConnected

Link copied to clipboard
abstract var verboseLogging: Boolean

Whether verbose logging is enabled. Defaults to false.

Functions

Link copied to clipboard
abstract fun callHandover(handoverListener: CallbackHandover)

Initiates a handover to a human agent. The listener is called when the handover is ready.

Link copied to clipboard
abstract fun clearCustomTheme()

Clears any custom theme that has been set and reverts to the default theme.

Link copied to clipboard
abstract fun clearNewContext()

Clears any previously set context.

Link copied to clipboard
abstract fun clearTriggerDialog()

Clears any pending trigger dialogue request.

Link copied to clipboard
abstract fun close()

Dismisses the chat UI without ending the session.

Link copied to clipboard
abstract fun displayChat(context: Context)

Displays the chat UI directly. NOTE: This method is kept for backward compatibility. It's recommended to use launchChat() instead which ensures proper connection before displaying the UI.

Link copied to clipboard
abstract fun endChat()

Ends the active chat session, clears messages and token, and dismisses the UI.

Link copied to clipboard
abstract fun handleNotification(remoteMessage: RemoteMessage)

Handles an incoming Firebase push notification. Call this from your FirebaseMessagingService.

Link copied to clipboard
abstract fun handleUrl(context: Context, uri: Uri): Boolean

Handles a Kindly URL scheme deep link. Supported format: kindly://chat/dialogue/{id}

Link copied to clipboard
abstract fun isKindlyNotification(remoteMessage: RemoteMessage): Boolean

Returns true if the given push notification originated from the Kindly service.

Link copied to clipboard
abstract fun kill()

Completely kills the SDK and clears all state. After calling this method, start() must be called again before using any other SDK functions. This is more destructive than endChat() which only disconnects the chat session.

Link copied to clipboard
abstract fun launchChat(context: Context, triggerDialogueId: String? = null)

Opens the chat bot after connecting to the Kindly service. This method handles both the connection to the Kindly service and displaying the UI. It's the recommended way to launch the chat experience.

Link copied to clipboard
abstract fun saveNotificationToken(token: String)

Saves the Firebase Cloud Messaging token for push notifications.

Link copied to clipboard
abstract fun sendMessage(message: String, newContext: Map<String, String>? = null): Deferred<MessageChat>

Send a message on behalf of the user, programmatically.

Link copied to clipboard
abstract fun setCustomTheme(theme: KindlyThemeColors)

Sets a custom theme for the chat UI.

abstract fun setCustomTheme(background: Color? = null, botMessageBackground: Color? = null, botMessageText: Color? = null, buttonBackground: Color? = null, buttonOutline: Color? = null, buttonText: Color? = null, chatLogElements: Color? = null, headerBackground: Color? = null, headerText: Color? = null, inputBackground: Color? = null, inputText: Color? = null, userMessageBackground: Color? = null, userMessageText: Color? = null, maintenanceHeaderBackground: Color? = null)

Sets a custom theme using individual color parameters. Only specified colors (non-null) will override the default theme.

Link copied to clipboard
abstract fun setLanguage(languageCode: String)

Updates the language for the current SDK session. This will be used for all subsequent chat connections and UI elements.

Link copied to clipboard
abstract fun setNewContext(context: Map<String, String>)

Sets context key-value pairs that will be attached to the next message or button click request.

Link copied to clipboard
abstract fun start(application: Application, botKey: String, languageCode: String = "en", authTokenCallback: AuthTokenCallback? = null)

Initializes the Kindly Chat SDK. This is the first method that should be called before using any other SDK functions. The SDK will automatically use NATIVE behavior for optimal performance and compliance.

Link copied to clipboard
abstract fun triggerDialogue(id: String)

Triggers a specific dialogue by its ID. The SDK must be connected.