Configuring the SDK
The Zendesk mobile SDKs provide default out-of-the-box behavior for many features that can be customized in code.
Using SDK configurations
Each of the SDK Activity
classes has its own implementation of the zendesk.configurations.Configuration
interface, which you can use to customize the appearance or behavior of the Activity
.
Each Configuration
has a builder you can use to show()
the Activity
directly. The
builder can also return the Configuration
instance itself via the config()
method (for
chaining more than one Configuration
together), or an Intent
via the intent()
method (if you don't want to start the Activity
straight away).
Customizing the bot label string
You can customize the string used for the "Answer Bot" label in the Unified SDK. This bot label is used across all the product SDK's engines (Answer Bot, Chat, and Support). The bordered "Bot" label that follows your bot label can't be removed.
Here's a simple example that customizes the string used for the "Answer Bot" label in the Unified SDK.
// Get a MessagingConfiguration.Builder
MessagingActivity.builder()
// set its properties
.withBotLabelString("My bot name")
// ... or use a resource
.withBotLabelStringRes(R.string.my_bot_name)
// start the Activity
.show(context);
Note: Zendesk has renamed our bot capabilities. Answer Bot is now Zendesk bots. For more information on this change, see this announcement.
Note: While Answer Bot is a specific Zendesk product, the string "Answer Bot" is used by default for all automated messages shown in the Unified SDK even if the active engine is not Answer Bot (for example, the Support engine displays automated messages prompting the user for an email address, or confirming when a ticket has been created). This is the case regardless of whether you have an active subscription to the Answer Bot product or not.
Note: from Messaging: 5.3.0
, the dependency of zendesk.messaging.MessagingActivity
has been updated to zendesk.classic.messaging.MessagingActivity
.
Enabling multi-line quick replies
There may be situations where the number of quick reply options causes the user to scroll horizontally through the options. Example: Selecting a department in chat. Multi-line wraps the quick responses and displays them vertically instead.
MessagingActivity.builder()
.withEngines(getEngines())
.withMultilineResponseOptionsEnabled(true)
.show(requireActivity(), chatConfigView.getChatConfiguration())
Note: from Messaging: 5.3.0
, the dependency of zendesk.messaging.MessagingActivity
has been updated to zendesk.classic.messaging.MessagingActivity
.
Multiple configurations in one screen
Each Configuration
show()
method takes an optional list of Configuration
configurations. Use this feature to configure
multiple screens or features at once. The following example shows how to customize the "Answer Bot" label
string as well as set a custom subject and tags for any requests created by the Support engine:
// Get a RequestConfiguration.Builder
Configuration requestConfiguration = RequestActivity.builder()
// set its properties
.withRequestSubject("Custom subject")
.withTags("tag1", "tag2")
// return an instance of the RequestConfiguration
.config();
// Get a MessagingConfiguration.Builder
MessagingActivity.builder()
// set its properties
.withBotLabelString("My bot name")
// ... or use a resource
.withBotLabelStringRes(R.string.my_bot_name)
// start the Activity, including the requestConfiguration object
.show(context, requestConfiguration);
Note: from Messaging: 5.3.0
, the dependency of zendesk.messaging.MessagingActivity
has been updated to zendesk.classic.messaging.MessagingActivity
.
Multiple configurations for multiple screens
You can also use the following pattern to configure multiple SDK activities at once. For example, when using the Support SDK, you can configure the Help Center screen and the Article screen to open the Messaging screen with the Answer Bot and Support engines. Here's how to configure all of these at once:
// Get a ViewArticleConfiguration.Builder
Configuration articleConfiguration = ViewArticleActivity.builder()
// set its properties
.withContactUsButtonVisible(false)
// return an instance of ViewArticleConfiguration
.config();
// Get a RequestConfiguration.Builder
Configuration requestConfiguration = RequestActivity.builder()
// set its properties
.withRequestSubject("Custom subject")
.withTags("tag1", "tag2")
// return an instance of the RequestConfiguration
.config();
// Get a MessagingConfiguration.Builder
Configuration messagingConfiguration = MessagingActivity.builder()
// set its properties
.withBotLabelString("My bot name")
// return an instance of the MessagingConfiguration
.config(context);
// Create a HelpCenterActivity.Builder
HelpCenterActivity.builder()
// set its properties
.withArticlesForCategoryIds(123L, 456L)
.withLabelNames("label1", "label2")
// add the Engines
.withEngines(AnswerBotEngine.engine(), SupportEngine.engine())
// start the Activity with all the Configurations
.show(context, articleConfiguration, requestConfiguration,
messagingConfiguration);
Note: from Messaging: 5.3.0
, the dependency of zendesk.messaging.MessagingConfiguration
has been updated to zendesk.classic.messaging.MessagingConfiguration
.