# Using Smartsupp
This page will describe methods which are available to you.
# Getting Mobile SDK Instance
Provides Mobile SDK instance which can be used for calling methods.
Smartsupp.instance()
# Opening Chat Box
Opens Chat box.
Smartsupp.instance()
.openChatBox(
onSuccessCallback = {
// Chat box is opening
},
onFailureCallback = { error ->
// Handle error
}
)
Method has two callbacks params onSuccessCallback
and onFailureCallback
. When onSuccessCallback
is callled, the Mobile SDK should then open a Activity with a Chat box in it.
When onFailureCallback
is called Chat box is not opened and Throwable
is returned. If this happens check your Smartsupp key and Api key if they are correctly setted in your Application.
WARNING
User have to be connected to the internet for opening the Chat box.
# User Identification
Method sets additonal properties for your user.
Smartsupp.instance()
.setUserProperties(
name = "John Doe",
email = "john.doe@example.com",
phone = "123 456 789",
variables = mapOf(
Pair("User_ID", "1234"),
Pair("Customer_status", "VIP"),
Pair("Customer_spending", "100 EUR"),
)
)
Each value is optional, so you can use only the ones you need.
TIP
For more information visit this (opens new window).
# Reset User
Method clears the current user's data and initiates a fresh chat session, providing a clean slate for interaction.
Smartsupp.instance().resetUser()
# Accounts Status
Start listening for AccountStatus
updates using:
Smartsupp.instance().addAccountStatusListener(listener)
In listener you will receive AccountStatus
which can be ONLINE
or OFFLINE
.
If you want to get current AccountStatus
use:
Smartsupp.instance().getAccountStatus()
# Number of Unread Messages
Start listening for unread messages updates using:
Smartsupp.instance().addUnreadMessageCountListener(listener)
If you want to get the current count of unread messages use:
Smartsupp.instance().getUnreadMessagesCount()
# Localization
By default, the ChatBox attempts to match the language of your app. To explicitly change the language, you can either use one of the predefined languages in the SmartsuppLanguage
enum or provide a String with the ISO 639-1 code of the desired language. If the specified language isn't supported, the default behavior will apply.
Smartsupp.instance().setChatBoxLanguage(langugage)
TIP