VartaAPI Desk · Android
Your chat, inside your Android app.
The same chat, help centre and tickets as on your website, drawn with Android’s own screens, in your colour. One library and a few lines of Kotlin. Make a free account first.
Add the library
The kit comes from our own address rather than Maven Central, so add it next to your other repositories in settings.gradle.kts, then add the library to your app’s build.gradle.kts.
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://app.vartaapi.com/maven") }
}
}
// app/build.gradle.kts
dependencies {
implementation("com.vartaapi:vartadesk:1.0.0")
}Start it when your app starts
Your workspace ID is on the Website chat page in VartaAPI (it starts with ws_). It is not a secret.
class ShopApp : Application() {
override fun onCreate() {
super.onCreate()
VartaDesk.setup(this, workspace = "ws_xxxxxxxxxx")
}
}Open the chat
From your own Help button or menu, or with our round chat button in the corner of any screen. Both show the unread count of replies.
// From any button: Home (the conversation, help, tickets)
VartaDesk.open(context)
// or straight into the conversation
VartaDesk.openChat(context)
// Or our chat button, in an Activity's onCreate
VartaDesk.showChatButton(this)
// Or a badge of your own
VartaDesk.setUnreadListener { count -> badge.text = count.toString() }Tell it who is signed in
Then your team sees the person as Verified, and their chat follows them to your website and to every phone. userHash is made on your server with the secret under Safety on the Website chat page, the same as for your website. Never put the secret in the app.
// After sign-in (userHash comes from your server)
VartaDesk.login(VartaDeskUser(userId = user.id, userHash = hash, name = user.name, email = user.email))
// On sign-out, so the next person on the phone starts fresh
VartaDesk.logout()
// On your server (Node.js)
const userHash = crypto.createHmac("sha256", process.env.VARTA_DESK_SECRET)
.update(String(user.id)).digest("hex");Notifications for replies
They come from your own app, through your own Firebase project. In VartaAPI, open Website chat, then Chat inside your mobile app, and paste your Firebase service-account key. Then hand the kit the phone’s token and the messages. On Android 13 and up your app asks for the notification permission as usual.
class Messages : FirebaseMessagingService() {
override fun onNewToken(token: String) = VartaDesk.setPushToken(token)
override fun onMessageReceived(m: RemoteMessage) {
if (VartaDesk.handlePush(this, m.data)) return // a reply: shown, a tap opens the chat
// ...your own notifications
}
}
// Once, after VartaDesk.setup(...)
FirebaseMessaging.getInstance().token.addOnSuccessListener(VartaDesk::setPushToken)- Works on
- Android 6 and up
- Size
- About 120 KB, plus OkHttp if your app doesn't have it already
- Permissions
- Internet only. Photos and files use Android's own pickers
- Inside
- Chat, help search and articles, tickets, photos and files, unread count, notifications
- Plans
- Every VartaAPI Desk plan, Hello (free) included
Version 1.0.0. No Android app? Any app can also open the chat as a web page: the address is on the Website chat page in VartaAPI, under Chat inside your mobile app.