1. Home
  2. SDKs
  3. Android SDK
  • User Guide
  • Developer Docs
Frequently visited sections What is verloop?, FAQ Overview?

Android SDK

Android: GitHub – verloop/android-sdk 

How to install

Add JitPack in your project’s gradle file :

 allprojects {  repositories {        ...        maven { url 'https://jitpack.io' }      }  } 

Then add the Verloop’s dependency in your app’s gradle file

 dependencies {
           implementation 'com.github.verloop:android-sdk:1.0.8'


In your MainActivity (or any of the activities), you need to initialize an object of Verloop class. It accepts a VerloopConfig object as an argument for initializing.

 var verloopConfig = VerloopConfig.Builder()  .clientId("CLIENT_ID")  .userId("USER_ID")  .fcmToken("FCMTOKEN_FOR_DEVICE")  .recipeId("RECIPE_ID")  .userName("USER_NAME")  .userEmail("USER_EMAIL")  .userPhone("USER_PHONE")  .department("DEPARTMENT")  .isStaging(true)  .fields(customFields)  .build() 

Params to VerloopConfig

clientId: Required, throws VerloopException if null

useId: Optional, if you don’t have a user ID, simply leave the field and our SDK will take care of it.

fcmToken: Optional, deeded if you want to receive Notifications.

recipeId: Optional, default recipe will run during the conversation unless we do a manual recipe override 

userName: Optional, User property

userPhone: Optional, User property

userPhone: Optional, User property

Department: Optional

isStaging: Optional, for testing env

fields: Optional, custom variables

Custom variables

You can send custom details of a customer with a conversation scope or a global scope.

Custom fields set on the conversation scope will have context associated with only that particular conversation. Once the conversation is over, you can set different values for a new conversation for the same customer. Use the following code to set the value:

verloopConfig.putCustomField("Test Field", "Test Value");


verloopConfig.putCustomField("Test Field", "Test Value", VerloopConfig.Scope.ROOM);

Global scope variables are associated with customers and not with conversation. Something like name, email etc. do not change on different conversations of the same user. To set the value for global scope variables:

verloopConfig.putCustomField("Test Field", "Test Value", VerloopConfig.Scope.USER);

Once config is ready, create Verloop object using the config and start chat

var verloop = Verloop(this, verloopConfig) // `this` here refers to an activity context.


Notifications will work only if you have added an FCM token at the time of the creation of the verloop config object

Now, to let Verloop handle Notifications, simply add this line in your FirebaseMessagingService class

 public void onMessageReceived(RemoteMessage remoteMessage) {
     int icon = R.drawable.notification_image; // set a drawable to use as icon for notifications
     VerloopNotification.showNotification(this, icon, remoteMessage.getData()); // This will be auto-ignored if notification is not from Verloop.
     // Do anything else with your message.

Notifications will not be shown in the system tray if chat activity is visible.

Handle Notification click

In your Launcher activity override onNewIntent as given below.

 override fun onNewIntent(intent: Intent?) {
     if (intent != null && intent.extras != null) {
         val verloopData = intent.extras?.get("verloop")
         if (verloopData != null) {
             val obj = JSONObject(verloopData.toString())
             if (obj.has("client_id")) clientId = obj.getString("client_id")
             if (obj.has("userId")) userId = obj.getString("userId")
         if (clientId === null) clientId = intent.extras?.get("clientId") as String?
         if (userId === null) userId = intent.extras?.get("userId") as String?
         if (clientId != null) {

In case you have multiple objects of Verloop class, use the one associated with clientId and userId received with intent data. If required create a new Verloop object with the same configuration.

Button click listener

At the time of having the conversation, bot shows a button for faster replies. Button click listeners can be added using:

 verloopConfig.setButtonClickListener(object: LiveChatButtonClickListener {
     override fun buttonClicked(title: String?, type: String?, payload: String?) {
         // Add the app logic for button click

URL click listener

If the user clicks on any URL provided by the bot or by the agent, then you can listen to the URL and take the action in the app. Actions can be like re-routing based on the product link etc. URL click listeners can be added using:

 verloopConfig2?.setUrlClickListener(object : LiveChatUrlClickListener {
 override fun urlClicked(url: String?) {
     // Add the app logic for url click
 }, true) 

You can override the default behaviour of URL click by setting the second parameter ‘overrideUrlClick’ to true. By default, it opens the URL in the browser. By adding a ‘urlClickListener’ and setting ‘overrideUrlClick’ true you can override this behaviour to get a callback and handle it yourself.

User session management

When the user logs out of your app, make sure to call


Notification Approval on Verloop.io Platform

In order to receive notification on the client’s mobile app using our SDK integration, the following details

  1. Go to Settings > Chat > Android SDK
  1. Add the FCM server key (Stage) sent to you
  2. Click on Save
Updated on December 27, 2022

Was this article helpful?

Related Articles

Schedule a demo

Get Started with Verloop.io