To integrate YMChat into your Android project using gradle, specify the following configurations in App level
Note: By puting + at the end, you need not to worry about updating and releaseing your app for every patch we are making in SDK. Still, if you want to use exact and latest version please visit the github repository mentioned https://github.com/yellowmessenger/YMChatbot-Android/releases
Note: Only for version v1.4.0 & above
Add following key in your
strings.xml file, this will override default file provider used by SDK.
Overriding the file provider path will avoid conflict with other app using YM CHATBOT SDK. You can use your application id and suffix it with ".fileprovider" Example - applicationId : "com.abc.xyz" then application_id_for_provider = com.abc.xyz.fileprovider
Import the YMChat library in your Activity.
After the library is imported the basic bot can be presented with few lines as below
onCreate method of the Activity:
YMConfig can be used to set the bot id and other bot related settings. It is recommended to set all appropriate config before starting the bot
botID to initialize. All other settings are optional.
ymAuthenticationToken is used to associate an identity of the user with the chat bot.
Whenever chatbot is launched with ymAuthenticationToken it will load the previous chats associated with this user since inception.
Note: History will load only when
Show history flag is enabled in the channel settings
YMChat supports firebase notifications. Assign your
FCM token to deviceToken
Note: Firebase service account key is required to send notifications. You can share the service account key with us. More info here
Additional information can be passed in the form of key value pair from app to bot using payload.
Payload can be used to pass information from host app to bot. The payload dictionary should be JSON compatible else an error will be thrown
For passing data from bot to app refer bot Bot Events
Payload is securely passed in HTTPS post request to protect the information passed in it
Your on-prem deployment URL can be set to
You can enable V2 bot by setting the version in config. Default value is 1
Speech to text can be enabled by setting the enableSpeech flag present in config. Default value is
Status bar color can be set on
statusBarColor color variable
Close button color can be set on
Once the config is set, chat bot can be presented by calling
startChatbot() and passing your Activity context as an argument
Bot events are used to pass information from bot to app. Events from bot can be handled using event Listeners. Simply define the
onSuccess method of
Bot close event is separately sent and it can be handled by listening to onBotClose event as mentioned below. To programatically close bot use
Bot can be programatically closed using
If you want to stop receiving push notifications you can unlink the device token. Device token typically is unlinked when the user logs out of the app.
Note: API key can be found in account settings under Access keys section after you login.
Following dependencies are used in chat bot SDK
We are declaring and asking for following permission in our manifest file
All permissions will be asked at run time except INTERNET. For attachment (picking file/images from phone storage)
For voice input
If facing problem in release build, add the following configuration in the app's proguard-rules.pro file.
A demo has been created to better understand the integration of SDK in Android app https://github.com/yellowmessenger/YmChatBot-Android-DemoApp