Back to Dashboard

Documentation

Learn how to use Asyntai

Kotlin Multiplatform Library

Add the Asyntai AI chatbot to your Android and iOS app

Create Account

Overview

Kotlin Multiplatform lets one Kotlin code base run on Android and iOS. The Asyntai library com.asyntai:asyntai-ai-chatbot opens your AI chatbot inside the app, on a full screen or in your own layout.

The assistant answers your users from your own website and documents, in more than 80 languages, day and night.

Requirements

  • Kotlin 2.2 or later
  • Android 6.0 (API 23) or later, iOS, or a desktop JVM app. On the desktop the chat opens in the browser
  • An Asyntai account on the Starter, Standard or Pro plan. The in-app chat is part of these plans

Installation

Follow these steps to add Asyntai to your app:

1

Get Your Widget ID

Sign in to Asyntai and open the Install page. The widget ID is the value of data-asyntai-id in the snippet shown there. It starts with asyntai_.

2

Add the Library

Add the dependency to the common source set in build.gradle.kts. The library is on Maven Central:

kotlin {
    sourceSets {
        commonMain.dependencies {
            implementation("com.asyntai:asyntai-ai-chatbot:1.0.0")
        }
    }
}

In an Android-only app, add it to dependencies { } in the same way.

3

Create the Chat

Create it once, in common code:

import com.asyntai.chatbot.AsyntaiChat

val chat = AsyntaiChat(widgetId = "asyntai_1a2b3c4d5e6f", title = "Support")
4

Open It

Android: from an activity or any other context:

import com.asyntai.chatbot.open

chat.open(context)

iOS: from a view controller:

import com.asyntai.chatbot.present

chat.present(viewController)

The chat opens on a full screen with a title and a close button. The library adds the Android internet permission for you.

Other Ways to Show the Chat

Put the chat inside your own Android layout, for example in a tab or a bottom sheet:

val view = AsyntaiChatView(context)
view.show(chat)
// In onDestroy:
view.destroy()

On iOS, push AsyntaiChatViewController(chat) on your navigation stack or put it in a tab.

Open the chat in the in-app browser of the phone, Custom Tabs on Android and Safari View Controller on iOS:

chat.openInBrowser(context)          // Android
chat.openInBrowser(viewController)   // iOS
chat.openInBrowser()                 // desktop JVM

Options

OptionTypeDefaultWhat it does
widgetIdStringrequiredYour Asyntai widget ID
titleString"Chat"The title in the top bar of the full chat screen
openLinksExternallyBooleantrueLinks in answers to other websites open in the phone browser, and the chat stays open

A wrong widget ID throws an IllegalArgumentException with a message that says how to fix it.

How It Works

The library shows your Asyntai chat in a web view inside the app. The input field stays above the keyboard, also in apps that draw edge to edge on Android 15 and later. Links to other websites, email addresses and phone numbers open in the matching app on the phone, so the conversation is still there when the user comes back.

Answering From Your Content

Asyntai reads your published pages. Add your site URL in the dashboard, and the assistant answers from them. You can also add documents, and question and answer pairs.

Tip: Change the colours, the welcome message and the AI instructions in the Asyntai dashboard. The change shows in your app at once, with no app update.

Removing It

Delete the dependency line from build.gradle.kts and the calls to the chat from your code.

Plans & Pricing

The library is free. The in-app chat is part of the Starter, Standard and Pro plans. View pricing.

Need Help?

If you have any questions or run into issues, contact us at [email protected].