Chat AI Kit - Easily integrate an AI bot in your app

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:

EventDescription
onSdkInitializedIndicates whether initialization succeeded and the number of bots.
onBotFetchedCalled for each bot fetched.
onChatStartedCalled when chat starts with a bot.
onMessageSentCalled when a message is sent by the user.
onMessageReceivedCalled when a message is received from the bot.
onErrorCaptures 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.

PropertyTypeDescription
idStringUnique bot identifier in the database
bot_idStringID exposed to the user
nameStringBot name
descriptionString?Bot description
created_atStringCreation date (ISO 8601)
profile_idStringProfile/owner ID
welcome_messageMap<String,String>?Optional welcome message
iconString?Bot icon URL
languageString?Language code, e.g., 'fr', 'en'
tonesList<String>?Tones used by the bot, e.g., ['friendly']
specializationsList<String>?Bot specializations
response_lengthString?Response length: 'short', 'medium', 'long'
openai_modelString?OpenAI model used
use_send_iconBooleanShow send icon or not
background_lightString?Background color in light mode
background_darkString?Background color in dark mode
bot_bubble_lightString?Bot bubble color in light mode
bot_bubble_darkString?Bot bubble color in dark mode
user_bubble_lightString?User bubble color in light mode
user_bubble_darkString?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)
Chat AI Kit - Easily integrate an AI bot in your app