Integrate with Android app


Below Steps shows an overview for developers integrating with Floatbot.ai SDK for the first time. It guides you through the process of setting up and sending and receiving instant messages.

To Change Text color and background color of chat use below methods


FloatBotColorConfig colorConfig = new FloatBotColorConfig();
//below methods will change bubble background color and text color,
First argument is for bubble background color, second is for text color
colorConfig.setUserColorColor.parseColor("#1E90FF"),Color.WHITE);
colorConfig.setBotColor(Color.parseColor("#1E90FF"),Color.WHITE);
//Below methods will change bot menu color and send button color and session background color colorConfig.setBotMenuColor(Color.parseColor("#1E90FF")); colorConfig.setSendButtonColor(Color.parseColor("#1E90FF")); colorConfig.setBotSessionColor(Color.parseColor("#1E90FF"));
//below methods are used to change toolbar color colorConfig.setToolbarBackIconColor(Color.parseColor("#1E90FF")); colorConfig.setToolbarColor(Color.parseColor("#1E90FF")); colorConfig.setToolbarTitleColor(Color.parseColor("#1E90FF"));
//At the end we will set object of FloatBotColorConfig in Floatbot FloatBot.setColorConfig(this,colorConfig);

To set notification for your app


NotificationConfig config = new NotificationConfig();
//This function is used to set channel id  
config.setChannelID("vini_channel");
//You can specify title and icons that will be displayd in notification 
config.setTitle("ViNi.ai" );
config.setLargeIcon(R.mipmap.ic_launcher);
config.setSmallIcon(R.mipmap.ic_launcher);
FloatBot.setNotificationConfig(this,config);

Use below function To hide/show list of seesions to user

FloatBot.setSingleConversation(this,true);

Use below Function to create authenticated user


 FloatBotUser user = new FloatBotUser();
 user.setNumber(""); 
 user.setEmailID(""); 
 user.setUserID(""); 
 user.setUserHash("");
 FloatBot.setUser(PinActivity.this,user);

 

Add maven { ... } part of code like below inside project level build.gradle file.


allprojects {
    repositories {
        google()
        maven { url  "https://jitpack.io" }
        maven { url  "https://maven.google.com"}
        jcenter()
        maven {
            url  "http://floatbot.ai:8081/artifactory/libs-release-local" 
        }
    }
}

Open build.gradle inside module that will use floatbot and simply add a dependency.


dependencies 
{ 
    compile 'floatbot.ai:floatbot:3.0'
}

If you are using Location Item in your bot, you need to add these library in your app's build.gradle


compile "com.google.android.gms:play-services-maps:15.0.1"
compile "com.google.android.gms:play-services-places:15.0.1"
compile "com.google.android.gms:play-services-location:15.0.1"

You need to add this meta data element in AndroidManifiest.xml's Application Tag with google api

<meta-data android:name="com.google.android.geo.API_KEY" android:value="googleapikey">

To start using Floatbot in android app, write below line anywhere in your activity/fragment

FloatBot.startChat(this,”Bot ID”,”Token”,"Bot name")

You will find Bot ID and Token in the chatbot settings of your Bot.

  • Go to Chatbot Section of your Dashboard

chatbot development platform

  • Go to Settings of your Chatbot

customer engagement bot

  • Inside Settings of your chatbot, you will find BOT ID and Token.

chatbot for call center

You can have a look at Sample