Adding Help Center

Help Center by Zendesk Guide provides your customers with a web-based, self-service knowledge base. You can use the Support SDK to show localized content in your Help Center, filter its contents to be more helpful, and use it as a jumping off point for creating a ticket.

The SDK provides the following two controllers to add Help Center to your iOS app:

  • HelpCenterOverviewController
  • ViewArticleController

If you need to build your own UIs, the SDK also has an API provider that gives you access to your organization's Help Center. See Help Center provider in the API providers reference.

Topics covered in this section:

Prerequisites

  • A Zendesk admin has activated Help Center in Zendesk Support. See Activating Help Center in the Support Help Center

  • One or more articles have been published in the knowledge base

  • a Zendesk admin has enabled Enable Guide for your iOS app in Zendesk Support. See Configuring the SDK in Zendesk Support in the Support Help Center

UI overview

The default UI of the HelpCenterOverviewController looks as follows:

help center view

To change the look and feel of the UI, see Customize the look. The UI doesn't inherit any styling from the web-based version of your Help Center.

The UI is localized in 33 languages and selects the appropriate language based on the device locale. The articles in your Help Center must be localized to view them in another language.

Tapping an article in the list shows the article content:

article view

If the user can't find an answer in Help Center, they have the option of tapping the pencil icon in the upper-right corner to open a ticket form:

ticket view

To configure the controller's ticket form, see Configure the ticket form of other SDK controllers.

You can disable the ticket form if you don't want it, or if you prefer adding a separate ticket form.

Show Help Center

Use the buildHelpCenterOverviewUiWithConfigs method of the HelpCenterUi. Example:

Swift

let helpCenter = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [])
self.navigationController?.pushViewController(helpCenter, animated: true)

Objective-C

UIViewController *helpCenter = [ZDKHelpCenterUi buildHelpCenterOverviewUiWithConfigs:@[]];
[self.navigationController pushViewController:helpCenter animated:YES];

Filter articles by category

Set the groupIds and groupType properties of the HelpCenterUiConfiguration. Example:

Swift

let hcConfig = HelpCenterUiConfiguration()
hcConfig.groupType = .category
hcConfig.groupIds = [1234, 5678]
let helpCenter = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [hcConfig])
self.navigationController?.pushViewController(helpCenter, animated: true)

Objective-C

ZDKHelpCenterUiConfiguration * hcConfig = [ZDKHelpCenterUiConfiguration new];
[hcConfig setGroupType:ZDKHelpCenterOverviewGroupTypeCategory];
[hcConfig setGroupIds:@[@1234, @5678]];
UIViewController *helpCenter = [ZDKHelpCenterUi buildHelpCenterOverviewUiWithConfigs:@[hcConfig]];
[self.navigationController pushViewController:helpCenter animated:YES];

Filter articles by section

Set the groupIds and groupType properties of the HelpCenterUiConfiguration. Example:

Swift

let hcConfig = HelpCenterUiConfiguration()
hcConfig.groupType = .section
hcConfig.groupIds = [1234, 5678]
let helpCenter = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [hcConfig])
self.navigationController?.pushViewController(helpCenter, animated: true)

Objective-C

ZDKHelpCenterUiConfiguration * hcConfig = [ZDKHelpCenterUiConfiguration new];
[hcConfig setGroupType:ZDKHelpCenterOverviewGroupTypeSection];
[hcConfig setGroupIds:@[@1234, @5678]];
UIViewController *helpCenter = [ZDKHelpCenterUi buildHelpCenterOverviewUiWithConfigs:@[hcConfig]];
[self.navigationController pushViewController:helpCenter animated:YES];

Filter articles by label

Set the labels property of the HelpCenterUiConfiguration. Example:

Swift

let hcConfig = HelpCenterUiConfiguration()
hcConfig.labels = ["ios", "xcode"]
let helpCenter = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [hcConfig])
self.navigationController?.pushViewController(helpCenter, animated: true)

Objective-C

ZDKHelpCenterUiConfiguration * hcConfig = [ZDKHelpCenterUiConfiguration new];
[hcConfig setLabels:@[@"ios", @"xcode"]];
UIViewController *helpCenter = [ZDKHelpCenterUi buildHelpCenterOverviewUiWithConfigs:@[configs]];
[self.navigationController pushViewController:helpCenter animated:YES];

Note: The labels are applied to the query by AND rather than OR. Returned content must match all specified labels.

Show a single article

To open a specific article, get the article's id, then use buildHelpCenterArticle.

Swift

let articleController = HelpCenterUi.buildHelpCenterArticleUi(withArticleId: 123, andConfigs: [])
self.navigationController?.pushViewController(articleController, animated: true)

Objective-C

UIViewController *articleController = [ZDKHelpCenterUi buildHelpCenterArticleUiWithArticleId:123 andConfigs:@[]];
[self.navigationController pushViewController:articleController animated:YES];

Configure the ticket screen

You can configure the ticketing screen of the HelpCenterOverviewController so that each new ticket has a common subject, common tags, or common file attachments. You can also set common values for one or more custom ticket fields, or set the custom ticket form to use in the agent interface in Zendesk Support.

First, configure the ticket screen with RequestUiConfiguration. See config in adding tickets.

Second, pass the UiConfiguration object to the andConfigs parameter of the ZDKRequestUi functions.

Example:

Swift

let requestConfig = RequestUiConfiguration()
requestConfig.subject = "iOS Ticket"
let helpCenter = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [requestConfig])
self.navigationController?.pushViewController(helpCenter, animated: true)

Objective-C

ZDKRequestUiConfiguration * requestConfig = [ZDKRequestUiConfiguration new];
requestConfig.subject = @"iOS Ticket";
UIViewController *helpCenter = [ZDKHelpCenterUi buildHelpCenterOverviewUiWithConfigs:@[requestConfig]];
[self.navigationController pushViewController:helpCenter animated:YES];

Disable ticket creation

The Help Center has navigation bar buttons that the user can tap to open a UI to create a ticket. The button is visible by default in both the Help Center article list view and article view. You can hide the button in one or both places. This is done using the HelpCenterUiConfiguration and the ArticleUiConfiguration.

Disable ticket creation in Help Center

On the Help Center screen, the ticket creation button appears in two places: - The navbar on the main screen - The search result screen when there are no search results

HelpCenterUiConfiguration has a boolean property for configuring the visibility of the ticket creation button in the two locations. It is false by default. You can customize the value as required.

Example:

Swift

func presentHelpCenter() {
    let helpCenterUiConfig = HelpCenterUiConfiguration()
    helpCenterUiConfig.hideContactSupport = true

    let articleUiConfig = ArticleUiConfiguration()
    articleUiConfig.hideContactSupport = true   // hide in article screen

    let helpCenterViewController = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [helpCenterUiConfig, articleUiConfig])
    self.navigationController?.pushViewController(helpCenterViewController, animated: true)
}

Objective-C

-(void) presentHelpCenter {
    ZDKHelpCenterUiConfiguration* helpCenterUiConfig = [ZDKHelpCenterUiConfiguration new];
    [helpCenterUiConfig setHideContactSupport: YES];

    ZDKArticleUiConfiguration* articleUiConfig = [ZDKArticleUiConfiguration new];
    [articleUiConfig setHideContactSupport: YES];

    UIViewController* controller = [ZDKHelpCenterUi buildHelpCenterOverviewUiWithConfigs: @[helpCenterUiConfig, articleUiConfig]];

    [self.navigationController pushViewController:controller animated:YES];
  }
Disable ticket creation in the article view

ArticleUiConfiguration has a boolean property for configuring the visibility of the ticket creation button on the article screen. It is false by default. You can customize the value as required.

Example:

Swift

func presentArticle() {
  let articleUiConfig = ArticleUiConfiguration()
  articleUiConfig.hideContactSupport = true

  let articleViewController = HelpCenterUi.buildHelpCenterArticleUi(withArticleId: 123, andConfigs: [articleUiConfig])
  self.navigationController?.pushViewController(articleViewController, animated: true)
}

Objective-C

-(void) presentArticle {
  ZDKArticleUiConfiguration* articleConfig = [ZDKArticleUiConfiguration new];
  [articleConfig setHideContactSupport: NO];

  UIViewController* controller = [ZDKHelpCenterUi buildHelpCenterArticleUiWithArticleId:123 andConfigs:@[articleConfig]];

  [self.navigationController pushViewController:controller animated:YES];
}
Disable ticket creation after an empty search result

Set hideContactSupport property of the HelpCenterUiConfiguration. Example:

Swift

func presentHelpCenter() {
  let hcConfig = HelpCenterUiConfiguration()
  hcConfig.hideContactSupport = true
  let helpCenter = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [hcConfig])
  self.navigationController?.pushViewController(helpCenter, animated: true)
}

Objective-C

- (void) presentHelpCenter {
  ZDKHelpCenterUiConfiguration * hcConfig = [ZDKHelpCenterUiConfiguration new];
  [hcConfig setHideContactSupport:YES];
  UIViewController* helpCenter = [ZDKHelpCenterUi buildHelpCenterOverviewUiWithConfigs: @[hcConfig]];
  [self.navigationController pushViewController:helpCenter animated:YES];
}

Using Support SDK with Answer Bot SDK

Answer Bot by Zendesk, provides a powerful mechanism for deflecting tickets before they reach your agents. The mobile SDK for Answer Bot is currently in an Early Access Program. For information on what Answer Bot can bring to your app, and how to join the Early Access Program visit this page.

If you have Answer Bot 1.0.0 and Support 3.0.0 (or above) present in your app, then the contact button in HelpCenterOverviewController and ViewArticleController will open Answer Bot by default. You can disable this and direct the user to ticket creation, using the following code snippet.

Swift

func presentHelpCenter() {
    let helpCenterUiConfig = HelpCenterUiConfiguration()
    helpCenterUiConfig.deflectionEnabled = false
    let articleUiConfig = ArticleUiConfiguration()
    articleUiConfig.deflectionEnabled = false
    let helpCenterViewController = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [helpCenterUiConfig, articleUiConfig])
    self.navigationController?.pushViewController(helpCenterViewController, animated: true)
}

Objective-C

-(void) presentHelpCenter {
    ZDKHelpCenterUiConfiguration* helpCenterUiConfig = [ZDKHelpCenterUiConfiguration new];
    helpCenterUiConfig.deflectionEnabled = NO;
    ZDKArticleUiConfiguration* articleUiConfig = [ZDKArticleUiConfiguration new];
    articleUiConfig.deflectionEnabled = NO;
    UIViewController* controller = [ZDKHelpCenterUi buildHelpCenterOverviewUiWithConfigs: @[helpCenterUiConfig, articleUiConfig]];
    [self.navigationController pushViewController:controller animated:YES];
  }

Overriding device locale

If you want to manually specify what language to use when fetching Help Center content you can do so with:

Swift

SupportUI.instance().helpCenterLocaleOverride = "<IETF language tag>"

Objective-C

[ZDKSupportUI instance].helpCenterLocaleOverride = @"<IETF language tag>";

If you're only using the API providers and building the UI yourself:

Swift

Support.instance().helpCenterLocaleOverride = "<IETF language tag>"

Objective-C

[ZDKSupport instance].helpCenterLocaleOverride = @"<IETF language tag>";

Locale override applies to all Help Center content fetched with the UI and Providers, regardless of whether you use Support or SupportUI. The language tag should be all lowercase, and there must be content for the specified locale.

Access a restricted Help Center

If your Help Center is restricted, add the following code to be set in the init of the view controller from which Help Center is called:

Swift

URLProtocol.registerClass(ZDKAuthenticationURLProtocol.self)

Objective-C

#import <ZendeskCoreSDK/ZendeskCoreSDK.h>

[NSURLProtocol registerClass:[ZDKAuthenticationURLProtocol class]];

This will ensure that any image attachments in articles will load correctly. If the Help Center has a host-mapped address, change the URL in your initialization code to the host mapped URL.

Next, add the following code snippet to the dealloc method

Swift

URLProtocol.unregisterClass(ZDKAuthenticationURLProtocol.self)

Objective-C

#import <ZendeskCoreSDK/ZendeskCoreSDK.h>

[NSURLProtocol unregisterClass:[ZDKAuthenticationURLProtocol class]];