Documentation
Installation
Add the dependency in your build.gradle :
implementation "com.dsilvera:chataikit-sdk:1.0.0"Configure the repositories in your settings.gradle :
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url "https://chataikit.com/sdk" }
}
}Initialization
Simple method: initialize the SDK with a success or error callback. You can get the list of available bots via InitResult.Success.bots.
ChatAIKit.initAsync(context, apiKey) { result ->
when(result) {
is InitResult.Success -> {
val bots = result.bots
bots.forEach { bot ->
Log.d("ChatAIKit", "Bot available: ${bot.name}")
}
}
is InitResult.Error -> {
Log.e("ChatAIKit", "Erreur: ${result.message}")
}
}
}Analytics SDK
Track key SDK events. Each event is described below:
| Event | Description |
|---|---|
| onSdkInitialized | Indicates whether initialization succeeded and the number of bots. |
| onBotFetched | Called for each bot fetched. |
| onChatStarted | Called when chat starts with a bot. |
| onMessageSent | Called when a message is sent by the user. |
| onMessageReceived | Called when a message is received from the bot. |
| onError | Captures all errors related to the SDK or bots. |
ChatAIKit.setAnalyticsListener(object : ChatAIAnalyticsListener {
override fun onSdkInitialized(success: Boolean, botsCount: Int, error: Throwable?) { ... }
override fun onBotFetched(bot: Bot) { ... }
override fun onChatStarted(bot: Bot) { ... }
override fun onMessageSent(bot: Bot, message: String) { ... }
override fun onMessageReceived(bot: Bot, message: String) { ... }
override fun onError(bot: Bot?, error: Throwable) { ... }
})Bot Documentation
All Bot properties can be configured from the admin panel. You can create or edit a bot to adjust its behavior, appearance, and messages.
To create a bot, you need to Create account.
| Property | Type | Description |
|---|---|---|
| id | String | Unique bot identifier in the database |
| bot_id | String | ID exposed to the user |
| name | String | Bot name |
| description | String? | Bot description |
| created_at | String | Creation date (ISO 8601) |
| profile_id | String | Profile/owner ID |
| welcome_message | Map<String,String>? | Optional welcome message |
| icon | String? | Bot icon URL |
| language | String? | Language code, e.g., 'fr', 'en' |
| tones | List<String>? | Tones used by the bot, e.g., ['friendly'] |
| specializations | List<String>? | Bot specializations |
| response_length | String? | Response length: 'short', 'medium', 'long' |
| openai_model | String? | OpenAI model used |
| use_send_icon | Boolean | Show send icon or not |
| background_light | String? | Background color in light mode |
| background_dark | String? | Background color in dark mode |
| bot_bubble_light | String? | Bot bubble color in light mode |
| bot_bubble_dark | String? | Bot bubble color in dark mode |
| user_bubble_light | String? | User bubble color in light mode |
| user_bubble_dark | String? | User bubble color in dark mode |
Start Chat
Two options to integrate the chat:
Full Activity
ChatAIKit.startChat(context, bot)Jetpack Compose (Composable)
ChatAIKit.Chat(bot = bot)
