models
KindlyEvent
data class
data class KindlyEvent(val type: KindlyEventType, val detail: KindlyEventDetail, val timestamp: Long = System.currentTimeMillis(), val detailJSON: String = "{}")Main event structure emitted by the Kindly SDK
Member | Declaration | Description |
|---|---|---|
KindlyEvent | constructor(type: KindlyEventType, detail: KindlyEventDetail, timestamp: Long = System.currentTimeMillis(), detailJSON: String = "{}") | |
detail | val detail: KindlyEventDetail | The event details |
detailJSON | val detailJSON: String | The event detail as JSON text: the SDK's own projection of what the chat widget sent (the fields of detail, capped like them), or the state for KindlyEventType.STATE. Lets wrappers forward events without hand-written serialisers. Never contains auth tokens or attachment URLs, and a URL the widget sends carries no query. Every value comes from the chat page, so treat it as untrusted input. |
rawType | val rawType: String | The web event name, for example kindly:ui (the same as KindlyEventType.value). |
timestamp | val timestamp: Long | When the event was emitted, in epoch milliseconds |
type | val type: KindlyEventType | The type of event |
KindlyEventAttachment
data class
data class KindlyEventAttachment(val id: String, val name: String, val format: String, val status: String, val sender: String, val storagePath: String)Attachment data for events. The download URL is never exposed (it carries the session token); storagePath identifies the file.
Member | Declaration | Description |
|---|---|---|
KindlyEventAttachment | constructor(id: String, name: String, format: String, status: String, sender: String, storagePath: String) | |
format | val format: String | Attachment format |
id | val id: String | Attachment ID |
name | val name: String | Attachment name |
sender | val sender: String | Attachment sender |
status | val status: String | Attachment status |
storagePath | val storagePath: String | Storage path |
KindlyEventButton
data class
data class KindlyEventButton(val id: String? = null, val type: String, val label: String, val value: String? = null, val index: Int? = null, val hasBeenSelected: Boolean = false, val context: Map<String, Any>? = null)Button data for events
Member | Declaration | Description |
|---|---|---|
KindlyEventButton | constructor(id: String? = null, type: String, label: String, value: String? = null, index: Int? = null, hasBeenSelected: Boolean = false, context: Map<String, Any>? = null) | |
context | val context: Map<String, Any>? | Button context data (at most 20 primitive entries) |
hasBeenSelected | val hasBeenSelected: Boolean | Whether the button has been selected |
id | val id: String? | Button ID |
index | val index: Int? | Button index |
label | val label: String | Button label text |
type | val type: String | Button type |
value | val value: String? | Button value (an absolute URL value has its query stripped) |
KindlyEventDetail
sealed class
sealed class KindlyEventDetailEvent details that can be associated with different event types
KindlyEventDetail.ButtonClick
data class
data class ButtonClick(val button: KindlyEventButton, val buttonType: String, val chatLog: List<KindlyEventMessage>, val lastMessage: KindlyEventMessage) : KindlyEventDetailButton click event
Member | Declaration | Description |
|---|---|---|
ButtonClick | constructor(button: KindlyEventButton, buttonType: String, chatLog: List<KindlyEventMessage>, lastMessage: KindlyEventMessage) | |
button | val button: KindlyEventButton | |
buttonType | val buttonType: String | |
chatLog | val chatLog: List<KindlyEventMessage> | |
lastMessage | val lastMessage: KindlyEventMessage | |
KindlyEventDetail.GlobalIcon
data class
data class GlobalIcon(val action: KindlyEventGlobalIcon) : KindlyEventDetailGlobal icon event
Member | Declaration | Description |
|---|---|---|
GlobalIcon | constructor(action: KindlyEventGlobalIcon) | |
action | val action: KindlyEventGlobalIcon | |
KindlyEventDetail.Load
data class
data class Load(val settings: KindlyEventSettings) : KindlyEventDetailSettings loaded event
Member | Declaration | Description |
|---|---|---|
Load | constructor(settings: KindlyEventSettings) | |
settings | val settings: KindlyEventSettings | |
KindlyEventDetail.Message
data class
data class Message(val newMessage: KindlyEventMessage, val chatLog: List<KindlyEventMessage>) : KindlyEventDetailMessage event with new message and chat log
Member | Declaration | Description |
|---|---|---|
Message | constructor(newMessage: KindlyEventMessage, chatLog: List<KindlyEventMessage>) | |
chatLog | val chatLog: List<KindlyEventMessage> | |
newMessage | val newMessage: KindlyEventMessage | |
KindlyEventDetail.State
data class
data class State(val state: KindlyEventState) : KindlyEventDetailState change event
Member | Declaration | Description |
|---|---|---|
State | constructor(state: KindlyEventState) | |
state | val state: KindlyEventState | |
KindlyEventDetail.UI
data class
data class UI(val action: KindlyEventUIAction) : KindlyEventDetailUI action event
Member | Declaration | Description |
|---|---|---|
UI | constructor(action: KindlyEventUIAction) | |
action | val action: KindlyEventUIAction | |
KindlyEventExchangeType
enum
enum KindlyEventExchangeType : Enum<KindlyEventExchangeType>Exchange types for events
Member | Declaration | Description |
|---|---|---|
DIALOGUE | DIALOGUE | dialogue: a reply from one of the bot's dialogues |
FALLBACK | FALLBACK | fallback: the bot's fallback reply, when no dialogue matched |
GREETING | GREETING | greeting: the bot's greeting |
SYSTEM_DIALOGUE | SYSTEM_DIALOGUE | system_dialogue: a system dialogue, including the widget's own system messages, which it marks system-dialogue |
USER_SAYS | USER_SAYS | user_says |
entries | val entries: EnumEntries<KindlyEventExchangeType> | Returns a representation of an immutable list of all enum entries, in the order they're declared. This method may be used to iterate over the enum entries. |
value | val value: String | |
valueOf | fun valueOf(value: String): KindlyEventExchangeType | Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) Throws - kotlin.IllegalArgumentException: if this enum type has no constant with the specified name |
values | fun values(): Array<KindlyEventExchangeType> | Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants. |
KindlyEventGlobalIcon
data class
data class KindlyEventGlobalIcon(val type: String, val source: String = "user", val value: Map<String, Any>? = null)Global icon action data for events
Member | Declaration | Description |
|---|---|---|
KindlyEventGlobalIcon | constructor(type: String, source: String = "user", value: Map<String, Any>? = null) | |
source | val source: String | Action source |
type | val type: String | Action type |
value | val value: Map<String, Any>? | Additional value data |
KindlyEventImage
data class
data class KindlyEventImage(val url: String, val altText: String? = null, val id: String? = null)Image data for events
Member | Declaration | Description |
|---|---|---|
KindlyEventImage | constructor(url: String, altText: String? = null, id: String? = null) | |
altText | val altText: String? | Alt text for accessibility |
id | val id: String? | Image ID |
url | val url: String | Image URL (query stripped) |
KindlyEventLanguage
data class
data class KindlyEventLanguage(val code: String, val name: String, val isDefault: Boolean = false)Language data for events
Member | Declaration | Description |
|---|---|---|
KindlyEventLanguage | constructor(code: String, name: String, isDefault: Boolean = false) | |
code | val code: String | Language code (e.g., "en", "es") |
isDefault | val isDefault: Boolean | Whether this is the default language |
name | val name: String | Language name (e.g., "English", "Spanish") |
KindlyEventMessage
data class
data class KindlyEventMessage(val id: String, val chatId: String? = null, val text: String? = null, val sender: KindlyEventMessageSender, val created: Date? = null, val isFromUser: Boolean, val exchangeID: String? = null, val videoSource: String? = null, val exchangeType: KindlyEventExchangeType? = null, val buttons: List<KindlyEventButton> = emptyList(), val images: List<KindlyEventImage> = emptyList(), val attachments: List<KindlyEventAttachment> = emptyList())Message data for events
Member | Declaration | Description |
|---|---|---|
KindlyEventMessage | constructor(id: String, chatId: String? = null, text: String? = null, sender: KindlyEventMessageSender, created: Date? = null, isFromUser: Boolean, exchangeID: String? = null, videoSource: String? = null, exchangeType: KindlyEventExchangeType? = null, buttons: List<KindlyEventButton> = emptyList(), images: List<KindlyEventImage> = emptyList(), attachments: List<KindlyEventAttachment> = emptyList()) | |
attachments | val attachments: List<KindlyEventAttachment> | Message attachments if any |
buttons | val buttons: List<KindlyEventButton> | Message buttons if any |
chatId | val chatId: String? | The chat/session ID this message belongs to (server chat_id) |
created | val created: Date? | Message creation timestamp |
exchangeID | val exchangeID: String? | Exchange ID if applicable |
exchangeType | val exchangeType: KindlyEventExchangeType? | Exchange type if applicable |
id | val id: String | Message ID (a message the user just typed carries a tempId-... id until the server confirms it) |
images | val images: List<KindlyEventImage> | Message images if any |
isFromUser | val isFromUser: Boolean | Whether the message is from the user |
sender | val sender: KindlyEventMessageSender | Message sender type |
text | val text: String? | Message text content |
videoSource | val videoSource: String? | Video source URL if applicable (query stripped) |
KindlyEventMessageSender
enum
enum KindlyEventMessageSender : Enum<KindlyEventMessageSender>Message sender types for events
Member | Declaration | Description |
|---|---|---|
AGENT | AGENT | A human agent, after a handover |
BOT | BOT | The bot |
SYSTEM | SYSTEM | A message from the chat itself rather than from a person or the bot |
USER | USER | The user of your app |
UNKNOWN | UNKNOWN | A sender this version does not map, such as the widget's WEBHOOK and EXTERNAL, or a message without one |
entries | val entries: EnumEntries<KindlyEventMessageSender> | Returns a representation of an immutable list of all enum entries, in the order they're declared. This method may be used to iterate over the enum entries. |
value | val value: String | |
valueOf | fun valueOf(value: String): KindlyEventMessageSender | Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) Throws - kotlin.IllegalArgumentException: if this enum type has no constant with the specified name |
values | fun values(): Array<KindlyEventMessageSender> | Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants. |
KindlyEventSettings
data class
data class KindlyEventSettings(val name: String, val id: String, val languages: List<KindlyEventLanguage>, val style: KindlyEventStyle)Settings data for load events
Member | Declaration | Description |
|---|---|---|
KindlyEventSettings | constructor(name: String, id: String, languages: List<KindlyEventLanguage>, style: KindlyEventStyle) | |
id | val id: String | Settings ID |
languages | val languages: List<KindlyEventLanguage> | Available languages |
name | val name: String | Settings name |
style | val style: KindlyEventStyle | Style configuration |
KindlyEventState
data class
data class KindlyEventState(val isChatDisplayed: Boolean, val isStarted: Boolean, val isSocketConnected: Boolean, val isConnected: Boolean, val connectionState: String)State data for events.
The web view SDK has no socket of its own (the hosted widget owns it), so the socket fields describe the chat page instead.
Member | Declaration | Description |
|---|---|---|
KindlyEventState | constructor(isChatDisplayed: Boolean, isStarted: Boolean, isSocketConnected: Boolean, isConnected: Boolean, connectionState: String) | |
connectionState | val connectionState: String | One of none, loading, connected, failed, unsupported, disconnected |
isChatDisplayed | val isChatDisplayed: Boolean | Whether the chat screen is currently visible |
isConnected | val isConnected: Boolean | Same as isSocketConnected: the chat page is loaded |
isSocketConnected | val isSocketConnected: Boolean | Whether the chat page is loaded (also while the chat is hidden) |
isStarted | val isStarted: Boolean | Whether the SDK has been started |
KindlyEventStyle
data class
data class KindlyEventStyle(val background: String? = null, val buttonBackground: String? = null, val buttonText: String? = null, val headerBackground: String? = null, val headerText: String? = null, val inputBackground: String? = null, val inputText: String? = null, val userMessageBackground: String? = null, val userMessageTextColor: String? = null, val botMessageBackground: String? = null, val botMessageTextColor: String? = null)Style data for events
Member | Declaration | Description |
|---|---|---|
KindlyEventStyle | constructor(background: String? = null, buttonBackground: String? = null, buttonText: String? = null, headerBackground: String? = null, headerText: String? = null, inputBackground: String? = null, inputText: String? = null, userMessageBackground: String? = null, userMessageTextColor: String? = null, botMessageBackground: String? = null, botMessageTextColor: String? = null) | |
background | val background: String? | Background color in hex format |
botMessageBackground | val botMessageBackground: String? | Bot message background color in hex format |
botMessageTextColor | val botMessageTextColor: String? | Bot message text color in hex format |
buttonBackground | val buttonBackground: String? | Button background color in hex format |
buttonText | val buttonText: String? | Button text color in hex format |
headerBackground | val headerBackground: String? | Header background color in hex format |
headerText | val headerText: String? | Header text color in hex format |
inputBackground | val inputBackground: String? | Input background color in hex format |
inputText | val inputText: String? | Input text color in hex format |
userMessageBackground | val userMessageBackground: String? | User message background color in hex format |
userMessageTextColor | val userMessageTextColor: String? | User message text color in hex format |
KindlyEventType
enum
enum KindlyEventType : Enum<KindlyEventType>Types of events that can be emitted by the Kindly SDK
Member | Declaration | Description |
|---|---|---|
LOAD | LOAD | Settings loaded event |
MESSAGE | MESSAGE | Message event |
BUTTON_CLICK | BUTTON_CLICK | Button click event |
UI | UI | UI action event |
GLOBAL_ICON | GLOBAL_ICON | Global icon event |
STATE | STATE | State change event |
entries | val entries: EnumEntries<KindlyEventType> | Returns a representation of an immutable list of all enum entries, in the order they're declared. This method may be used to iterate over the enum entries. |
value | val value: String | |
valueOf | fun valueOf(value: String): KindlyEventType | Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) Throws - kotlin.IllegalArgumentException: if this enum type has no constant with the specified name |
values | fun values(): Array<KindlyEventType> | Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants. |
KindlyEventUIAction
data class
data class KindlyEventUIAction(val type: KindlyUIActionType, val source: String = "user", val chatId: String, val value: Map<String, Any>? = null, val feedbackType: String? = null, val feedbackValue: Map<String, Any>? = null, val languageCode: String? = null, val languageName: String? = null, val previousLanguageCode: String? = null, val previousLanguageName: String? = null, val nextPage: String? = null)UI action data for events
Member | Declaration | Description |
|---|---|---|
KindlyEventUIAction | constructor(type: KindlyUIActionType, source: String = "user", chatId: String, value: Map<String, Any>? = null, feedbackType: String? = null, feedbackValue: Map<String, Any>? = null, languageCode: String? = null, languageName: String? = null, previousLanguageCode: String? = null, previousLanguageName: String? = null, nextPage: String? = null) | |
chatId | val chatId: String | Chat ID (empty when the widget sent none) |
feedbackType | val feedbackType: String? | Feedback type if applicable |
feedbackValue | val feedbackValue: Map<String, Any>? | Feedback value if applicable |
languageCode | val languageCode: String? | Language code for language change events |
languageName | val languageName: String? | Language name for language change events |
nextPage | val nextPage: String? | Next page for navigation events |
previousLanguageCode | val previousLanguageCode: String? | Previous language code for language change events |
previousLanguageName | val previousLanguageName: String? | Previous language name for language change events |
source | val source: String | Action source (user or programmatic) |
type | val type: KindlyUIActionType | Action type |
value | val value: Map<String, Any>? | Additional value data |
KindlyUIActionType
enum
enum KindlyUIActionType : Enum<KindlyUIActionType>Types of UI actions that can be performed
Member | Declaration | Description |
|---|---|---|
OPEN_CHAT_BUBBLE | OPEN_CHAT_BUBBLE | Open chat bubble |
CLOSE_CHAT_BUBBLE | CLOSE_CHAT_BUBBLE | Close chat bubble |
END_CHAT | END_CHAT | End chat |
RESTART_CHAT | RESTART_CHAT | Restart chat |
DOWNLOAD_CHAT | DOWNLOAD_CHAT | Download chat |
DELETE_CHAT | DELETE_CHAT | Delete chat |
CHANGE_LANGUAGE | CHANGE_LANGUAGE | Change language |
SHOW_FEEDBACK | SHOW_FEEDBACK | Show feedback |
SUBMIT_FEEDBACK | SUBMIT_FEEDBACK | Submit feedback |
DISMISS_FEEDBACK | DISMISS_FEEDBACK | Dismiss feedback |
WELCOME_PAGE_START_CHAT | WELCOME_PAGE_START_CHAT | The user started the chat from the widget's welcome page |
entries | val entries: EnumEntries<KindlyUIActionType> | Returns a representation of an immutable list of all enum entries, in the order they're declared. This method may be used to iterate over the enum entries. |
value | val value: String | |
valueOf | fun valueOf(value: String): KindlyUIActionType | Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) Throws - kotlin.IllegalArgumentException: if this enum type has no constant with the specified name |
values | fun values(): Array<KindlyUIActionType> | Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants. |
KindlyUIActionType.Companion
object
object CompanionMember | Declaration | Description |
|---|---|---|
fromValue | fun fromValue(value: String?): KindlyUIActionType? | The action for a widget ui event type, or null for a type this SDK does not know. |