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).

Customize the bot label string

Here's a simple example that customizes the string used for the "Answer Bot" label in the Messaging 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: 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.

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);
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);