Customization on Android SDK
- Getting Started
- Bot Building
- Smart Agent Chat
- Conversation Design
-
Developer Guides
Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
- Deployment
- External Agent Tool Setup
- Analytics & Reporting
- Notifications
- Commerce Plus
- Troubleshooting Guides
- Release Notes
Table of Contents
SDK Customization Settings
The SDK can be configured in a variety of ways to fit in seamlessly with the overall experience of the parent application. While initializing Haptik SDK, you pass the desired customization according to your need.
Settings:
- primaryColor: String - The primary color used throughout the SDK.
- tabletbgColor: String - Use this setting to change the background fill color for tablet devices.
- enableTypingSuggestions: Boolean - Enables typing suggestions for the bot. Typing suggestions are autocompleting suggestions that show up for users when they type. This gives the user some context around the capabilities of the bot.
- hideComposer: Boolean - Hides the composer so that the user is not given the option to type anything. This is useful when building actionable and highly directed bots.
- noHeader: Boolean - Hides the chat window header.
- privacyPolicyUrl: String - If GDPR is enabled, you can add a URL to your Privacy Policy page through init settings. Users will be redirected to this URL when they click on the link in the GDPR view. If not provided users will be redirected to Haptik's privacy policy page
- initializeLanguage: String - Code of language you want to open bot with. For eg: en, hi . We support ISO_639-1 language codes.
- composerPlaceholder: String - The placeholder text for the composer (typing area). This is the text that's shown in the typing area when it's empty.
- customCss: String - A custom css file can be injected into the SDK, which will allow modifying the styles of the conversation screen. This parameter takes a URL path of the CSS file.
- ignoreStorage: Boolean - If ignoreStorage is true the storage is disabled, i.e. a new user is created every time the user comes back and starts conversing with the bot. No messages/user information is stored in local storage.
-
skipSignupChatHistory: Boolean - If set to true, SDK will not fetch old chat history when an existing user performs signup again.
Example:
Kotlin Code:
val initData = InitData().apply { primaryColor = "#420420" composerPlaceholder = "Type message...." noHeader = true initializeLanguage = "en" } HaptikSDK.init(applicationContext, initData)
Java Code:
InitData initData = new InitData(); initData.setPrimaryColor("#420420"); initData.setComposerPlaceholder("Type Message...."); initData.setNoHeader(true); initData.setInitializeLanguage("en"); HaptikSDK.INSTANCE.init(this, initData);
Launch Message
You can launch the Bot with a task or message on behalf of the user. Haptik provides the following method for doing so.
Point to note:
Call this method before calling HaptikSDK.loadGuestConversation() or HaptikSDK.loadConversation(signupData).
Kotlin Code:
HaptikSDK.setLaunchMessage("Your Message", false, false, false)
Java Code:
HaptikSDK.INSTANCE.setLaunchMessage("Hello custom sign up", false, false, false);
Params:
- message <String> - The message that is to be sent.
- hidden <Boolean> - Whether to send the message as a hidden user message. A hidden message is not visible to the user but can be seen by the agent or bot.
- skipMessage <Boolean>- If set to true, the SDK will not send a launch message if the last message is a reply to a previous launch message.
- hideWelcomeMessage<Boolean> - If set to true, the Welcome Message will not be shown when the launch message is sent.
CSS Customizations
A custom CSS file can be provided to the SDK, which will allow modifying its styles. This parameter takes a path of the CSS file hosted on a server. An example CSS is available at https://tinyurl.com/ybazgbq4 for you to get started.
Update User Data
You can use HaptikSDK.updateUserData(userdata) method to update the user details and custom data. Make sure to call this method only after signup. Only email, mobile_no, username, and custom_data fields are allowed in the userData dictionary.
Examples:
val customData = JSONObject().apply { put("order_id", 12345) put("date", "01/01/2022") } val userdata = JSONObject().apply { put("email", "test@email.com") put("mobile_no", "9898989898") put("username", "User Name") put("custom_data", customData) } HaptikSDK.updateUserData(userdata)
You can omit the fields which are not required to be updated.
val customData = JSONObject().apply { put("order_id", 12345) put("date", "01/01/2022") } val userdata = JSONObject().apply { put("username", "User Name") put("custom_data", customData) } HaptikSDK.updateUserData(userdata)