HelpshiftSupport Class Reference

Inherits from NSObject
Conforms to HsApiProvider
Declared in HelpshiftSupport.h

Overview

This document describes the API exposed by the Helpshift SDK (4.x) which the developers can use to integrate Helpshift support into their iOS applications. If you want documentation regarding how to use the various features provided by the Helpshift SDK, please visit the developer docs

+ sharedInstance

Returns an instance of Helpshift

+ (HelpshiftSupport *)sharedInstance

Availability

Available in SDK version 5.0.0 or later

Discussion

Returns an instance of Helpshift

When calling any Helpshift instance method you must use sharedInstance. For example to call showSupport: you must call it like [[Helpshift sharedInstance] showSupport:self];

Declared In

HelpshiftSupport.h

+ pauseDisplayOfInAppNotification:

To pause and restart the display of inapp notification

+ (void)pauseDisplayOfInAppNotification:(BOOL)pauseInApp

Parameters

pauseInApp

the boolean value to pause/restart inapp nofitications

Availability

Available in SDK version 5.0.0 or later

Discussion

To pause and restart the display of inapp notification

When this method is called with boolean value YES, inapp notifications are paused and not displayed. To restart displaying inapp notifications pass the boolean value NO.

Declared In

HelpshiftSupport.h

+ setSDKLanguage:

Change the SDK language. By default, the device’s prefered language is used. If a Helpshift session is already active at the time of invocation, this call will fail and will return false.

+ (BOOL)setSDKLanguage:(NSString *)languageCode

Parameters

languageCode

the string representing the language code. For example, use ‘fr’ for French.

Return Value

BOOL indicating wether the specified language was applied. In case the language code is incorrect or the corresponding localization file was not found, bool value of false is returned and the default language is used.

Availability

Available in SDK version 5.0.0 or later

Discussion

Change the SDK language. By default, the device’s prefered language is used. If a Helpshift session is already active at the time of invocation, this call will fail and will return false.

Declared In

HelpshiftSupport.h

+ showConversation:withOptions:

Show the helpshift conversation screen (with Optional Arguments)

+ (void)showConversation:(UIViewController *)viewController withOptions:(NSDictionary *)optionsDictionary

Parameters

viewController

viewController on which the helpshift report issue screen will show up.

optionsDictionary

the dictionary which will contain the arguments passed to the Helpshift conversation session (that will start with this method call).

Please check the docs for available options.

Availability

Available in SDK version 5.0.0 or later

Discussion

Show the helpshift conversation screen (with Optional Arguments)

To show the Helpshift conversation screen with optional arguments you will need to pass the name of the viewcontroller on which the conversation screen will show up and an options dictionary. If you do not want to pass any options then just pass nil which will take on the default options.

Declared In

HelpshiftSupport.h

+ showFAQs:withOptions:

Show the support screen with only the faqs (with Optional Arguments)

+ (void)showFAQs:(UIViewController *)viewController withOptions:(NSDictionary *)optionsDictionary

Parameters

viewController

viewController on which the helpshift faqs screen will show up.

optionsDictionary

the dictionary which will contain the arguments passed to the Helpshift faqs screen session (that will start with this method call).

Please check the docs for available options.

Availability

Available in SDK version 5.0.0 or later

Discussion

Show the support screen with only the faqs (with Optional Arguments)

To show the Helpshift screen with only the faq sections with search with optional arguments, you can use this api. If you do not want to pass any options then just pass nil which will take on the default options.

Declared In

HelpshiftSupport.h

+ showFAQSection:withController:withOptions:

Show the helpshift screen with faqs from a particular section

+ (void)showFAQSection:(NSString *)faqSectionPublishID withController:(UIViewController *)viewController withOptions:(NSDictionary *)optionsDictionary

Parameters

faqSectionPublishID

the publish id associated with the faq section which is shown in the FAQ page on the admin side (yourcompanyname.helpshift.com/admin/faq/).

viewController

viewController on which the helpshift faq section screen will show up.

optionsDictionary

the dictionary which will contain the arguments passed to the Helpshift session (that will start with this method call).

Availability

Available in SDK version 5.0.0 or later

Discussion

Show the helpshift screen with faqs from a particular section

To show the Helpshift screen for showing a particular faq section you need to pass the publish-id of the faq section and the name of the viewcontroller on which the faq section screen will show up. For example from inside a viewcontroller you can call the Helpshift faq section screen by passing the argument “self” for the viewController parameter. If you do not want to pass any options then just pass nil which will take on the default options.

Declared In

HelpshiftSupport.h

+ showSingleFAQ:withController:withOptions:

Show the helpshift screen with a single faq

+ (void)showSingleFAQ:(NSString *)faqPublishID withController:(UIViewController *)viewController withOptions:(NSDictionary *)optionsDictionary

Parameters

faqPublishID

the publish id associated with the faq which is shown when you expand a single FAQ (yourcompanyname.helpshift.com/admin/faq/)

viewController

viewController on which the helpshift faq section screen will show up.

optionsDictionary

the dictionary which will contain the arguments passed to the Helpshift session (that will start with this method call).

Availability

Available in SDK version 5.0.0 or later

Discussion

Show the helpshift screen with a single faq

To show the Helpshift screen for showing a single faq you need to pass the publish-id of the faq and the name of the viewcontroller on which the faq screen will show up. For example from inside a viewcontroller you can call the Helpshift faq section screen by passing the argument “self” for the viewController parameter. If you do not want to pass any options then just pass nil which will take on the default options.

Declared In

HelpshiftSupport.h

+ showAlertToRateAppWithURL:withCompletionBlock:

Show alert for app rating

+ (void)showAlertToRateAppWithURL:(NSString *)url withCompletionBlock:(HelpshiftSupportAppRatingAlertViewCompletionBlock)completionBlock

Availability

Available in SDK version 5.0.0 or later

Discussion

Show alert for app rating

To manually show an alert for app rating, you need automated reviews disabled in admin. Also, if there is an ongoing conversation, the review alert will not show up.

Declared In

HelpshiftSupport.h

+ setUserIdentifier:

Set an user identifier for your users.

+ (void)setUserIdentifier:(NSString *)userIdentifier

Parameters

userIdentifier

A string to identify your users.

Availability

Available in SDK version 5.0.0 or later

Discussion

Set an user identifier for your users.

This is part of additional user configuration. The user identifier will be passed through to the admin dashboard as “User ID” under customer info.

Declared In

HelpshiftSupport.h

+ leaveBreadCrumb:

Add extra debug information regarding user-actions.

+ (void)leaveBreadCrumb:(NSString *)breadCrumbString

Parameters

breadCrumbString

The string containing any relevant debugging information.

Availability

Available in SDK version 5.0.0 or later

Discussion

Add extra debug information regarding user-actions.

You can add additional debugging statements to your code, and see exactly what the user was doing right before they reported the issue.

Declared In

HelpshiftSupport.h

+ setMetadataBlock:

Provide a block which returns a dictionary for custom meta data to be attached along with new conversations

+ (void)setMetadataBlock:(HelpshiftSupportMetadataBlock)metadataBlock

Parameters

metadataBlock

a block variable which accepts zero arguments and returns an NSDictionary.

Availability

Available in SDK version 5.0.0 or later

Discussion

Provide a block which returns a dictionary for custom meta data to be attached along with new conversations

If you want to attach custom data along with any new conversation, use this api to provide a block which accepts zero arguments and returns an NSDictionary containing the meta data key-value pairs. Everytime an issue is reported, the SDK will call this block and attach the returned meta data dictionary along with the reported issue. Ideally this metaDataBlock should be provided before the user can file an issue.

Declared In

HelpshiftSupport.h

+ getNotificationCountFromRemote:

Get the notification count for replies to new conversations.

+ (NSInteger)getNotificationCountFromRemote:(BOOL)isRemote

Parameters

isRemote

Whether the notification count is to be returned asynchronously via delegate mechanism or synchronously as a return val for this api

Availability

Available in SDK version 5.0.0 or later

Discussion

Get the notification count for replies to new conversations.

If you want to show your user notifications for replies on any ongoing conversation, you can get the notification count asynchronously by implementing the HelpshiftSupportDelegate in your respective .h and .m files. Use the following method to set the delegate, where self is the object implementing the delegate. [[Helpshift sharedInstance] setDelegate:self]; Now you can call the method [[Helpshift sharedInstance] getNotificationCountFromRemote:YES]; This will return a notification count in the - (void) didReceiveNotificationCount:(NSInteger)count count delegate method. If you want to retrieve the current notification count synchronously, you can call the same method with the parameter set to false, i.e NSInteger count = [[Helpshift sharedInstance] getNotificationCountFromRemote:NO]

Declared In

HelpshiftSupport.h

+ handleRemoteNotification:withController:

Forward the push notification for the Helpshift lib to handle

+ (void)handleRemoteNotification:(NSDictionary *)notification withController:(UIViewController *)viewController

Parameters

notification

The dictionary containing the notification information

viewController

ViewController on which the helpshift support screen will show up.

Example usage - (void) application:(UIApplication )application didReceiveRemoteNotification:(NSDictionary )userInfo { if ([[userInfo objectForKey:@“origin”] isEqualToString:@“helpshift”]) { [[Helpshift sharedInstance] handleRemoteNotification:userInfo withController:self.viewController]; } }

Availability

Available in SDK version 5.0.0 or later

Discussion

Forward the push notification for the Helpshift lib to handle

To show support on Notification opened, call handleRemoteNotification in your application:didReceiveRemoteNotification application delegate. If the value of the “origin” field is “helpshift” call the handleRemoteNotification api

Declared In

HelpshiftSupport.h

+ handleLocalNotification:withController:

Forward the local notification for the Helpshift lib to handle

+ (void)handleLocalNotification:(UILocalNotification *)notification withController:(UIViewController *)viewController

Parameters

notification

The UILocalNotification object containing the notification information

viewController

ViewController on which the helpshift support screen will show up.

Example usage - (void) application:(UIApplication )application didReceiveLocalNotification:(UILocalNotification )notification { if ([[notification.userInfo objectForKey:@“origin”] isEqualToString:@“helpshift”]) [[Helpshift sharedInstance] handleLocalNotification:notification withController:self.viewController]; }

Availability

Available in SDK version 5.0.0 or later

Discussion

Forward the local notification for the Helpshift lib to handle

To show support on Notification opened, call handleLocalNotification in your application:didReceiveLocalNotification application delegate. If the value of the “origin” field is “helpshift” call the handleLocalNotification api

Declared In

HelpshiftSupport.h

+ clearBreadCrumbs

Clears Breadcrumbs list.

+ (void)clearBreadCrumbs

Availability

Available in SDK version 5.0.0 or later

Discussion

Clears Breadcrumbs list.

Breadcrumbs list stores upto 100 latest actions. You’ll receive those in every Issue. If for some reason you want to clear previous messages, you can use this method.

Declared In

HelpshiftSupport.h

+ closeHelpshiftSupportSession

Close the current Helpshift session

+ (void)closeHelpshiftSupportSession

Availability

Available in SDK version 5.0.0 or later

Discussion

Close the current Helpshift session

If currently any Helpshift session is active, this API will close that session. Otherwise if any Helpshift session is not active, this API does nothing.

Declared In

HelpshiftSupport.h

+ handleContinueUserActivity:withController:andRestorationHandler:

Let the Helpshift SDK handle the continue user activity delegate. This method should be called from the application’s handleContinueUserActivity delegate. Currently this method is required for the FAQ integration with CoreSpotlight search to work correctly.

+ (BOOL)handleContinueUserActivity:(NSUserActivity *)userActivity withController:(UIViewController *)viewController andRestorationHandler:(void ( ^ ) ( NSArray *))restorationHandler

Parameters

userActivity

useractivity object receieved in the delegate callback

viewController

view controller on which Helpshift should show the FAQ detail screen.

restorationHandler

restoration handler received in the delegate callback

Return Value

returns YES if Helpshift has handled the event, NO otherwise.

Discussion

Let the Helpshift SDK handle the continue user activity delegate. This method should be called from the application’s handleContinueUserActivity delegate. Currently this method is required for the FAQ integration with CoreSpotlight search to work correctly.

Declared In

HelpshiftSupport.h

+ showDynamicFormOnViewController:withTitle:andFlows:withConfigOptions:

Use this method to create a list of custom ‘flows’ and present them in tabular form to the user. A flow consists of 1) The text to be displayed (like ‘I think a player is cheating’) and 2) The action to be invoked for this option (like ‘showConversation:’). In this case besides calling the showConversation: method, Helpshfit will also add a tag (‘I think a player is cheating’, or any other custom tag) to the filed issue. These tags can later be used by you to gain insight as to how users are using your support. Actions supported by Dynamic forms: showConversation:, showFAQs:, showSingleFAQ:, showFAQSection: and showNextDynamicForm: (for nesting forms).

+ (BOOL)showDynamicFormOnViewController:(UIViewController *)viewController withTitle:(NSString *)title andFlows:(NSArray *)flows withConfigOptions:(NSDictionary *)configOptions

Parameters

viewController

The view controller on which Dynamic form will be presented.

title

The title of the form.

flows

A list of ‘HsFlow’ objects.

configOptions

Config option that applies to Dynamic form itself (NOTE: this is not automatically applied to the flows). Currently the only config option applicable her is ‘presentFullScreenOniPad’ which can be ‘yes’ or ‘no’

Return Value

Returns YES if the data provided was valid to create a dynamic form, otherwise returns NO.

Discussion

Use this method to create a list of custom ‘flows’ and present them in tabular form to the user. A flow consists of 1) The text to be displayed (like ‘I think a player is cheating’) and 2) The action to be invoked for this option (like ‘showConversation:’). In this case besides calling the showConversation: method, Helpshfit will also add a tag (‘I think a player is cheating’, or any other custom tag) to the filed issue. These tags can later be used by you to gain insight as to how users are using your support. Actions supported by Dynamic forms: showConversation:, showFAQs:, showSingleFAQ:, showFAQSection: and showNextDynamicForm: (for nesting forms).

Declared In

HelpshiftSupport.h

+ pushDynamicFormOnViewController:withTitle:andFlows:

This is the push variant of showDynamicFormOnViewController: Use this method if you want to push the dynamic form to your navigation stack.

+ (BOOL)pushDynamicFormOnViewController:(UIViewController *)viewController withTitle:(NSString *)title andFlows:(NSArray *)flows

Parameters

viewController

The view controller on which Dynamic form will be pushed.

title

The title of the form.

flows

A list of ‘HsFlow’ objects.

Return Value

Returns YES if the data provided was valid to create a dynamic form, otherwise returns NO.

Discussion

This is the push variant of showDynamicFormOnViewController: Use this method if you want to push the dynamic form to your navigation stack.

Declared In

HelpshiftSupport.h

+ dynamicFormWithTitle:andFlows:

Creates and returns the a Dynamic Form view controller. This is a variant of showDynamicFormOnViewController: Use this variant if you want to embed dynamic form in a UITabBarController

+ (UIViewController *)dynamicFormWithTitle:(NSString *)title andFlows:(NSArray *)flows

Parameters

title

The title of the form.

flows

A list of ‘HsFlow’ objects.

Return Value

Returns a UIViewController if the data provided was valid to create a dynamic form, otherwise returns nil.

Discussion

Creates and returns the a Dynamic Form view controller. This is a variant of showDynamicFormOnViewController: Use this variant if you want to embed dynamic form in a UITabBarController

Declared In

HelpshiftSupport.h

+ flowToShowConversationWithDisplayText:andConfigOptions:

Create a flow object which launches the conversation view when tapped. Refer to showConversation: for more details.

+ (id)flowToShowConversationWithDisplayText:(NSString *)displayText andConfigOptions:(NSDictionary *)configOptions

Parameters

displayText

Text to be displayed in the row.

configOptions

The config options to be passed to showConversation: method.

Return Value

a flow object to be used for creating a dynamic form.

Discussion

Create a flow object which launches the conversation view when tapped. Refer to showConversation: for more details.

Declared In

HelpshiftSupport.h

+ flowToShowFAQsWithDisplayText:andConfigOptions:

Create a flow object which shows all the FAQs when tapped. Refer to showFAQs: for more details.

+ (id)flowToShowFAQsWithDisplayText:(NSString *)displayText andConfigOptions:(NSDictionary *)configOptions

Parameters

displayText

Text to be displayed in the row.

configOptions

The config options to be passed to showFAQSection: method.

Return Value

a flow object to be used for creating a dynamic form.

Discussion

Create a flow object which shows all the FAQs when tapped. Refer to showFAQs: for more details.

Declared In

HelpshiftSupport.h

+ flowToShowFAQSectionForPublishId:withDisplayText:andConfigOptions:

Create a flow object which launches a FAQ section when tapped. Refer to showFAQSection: for more details.

+ (id)flowToShowFAQSectionForPublishId:(NSString *)sectionPublishId withDisplayText:(NSString *)displayText andConfigOptions:(NSDictionary *)configOptions

Parameters

sectionPublishId

The Publish-Id of the FAQ section.

displayText

Text to be displayed in the row.

configOptions

The config options to be passed to showFAQSection: method.

Return Value

a flow object to be used for creating a dynamic form.

Discussion

Create a flow object which launches a FAQ section when tapped. Refer to showFAQSection: for more details.

Declared In

HelpshiftSupport.h

+ flowToShowSingleFAQForPublishId:withDisplayText:andConfigOptions:

Create a flow object which launches a single FAQ when tapped. Refer to showSingleFAQ: for more details.

+ (id)flowToShowSingleFAQForPublishId:(NSString *)FAQPublishId withDisplayText:(NSString *)displayText andConfigOptions:(NSDictionary *)configOptions

Parameters

FAQPublishId

The Publish-Id of the FAQ.

displayText

Text to be displayed in the row.

configOptions

The config options to be passed to showSingleFAQ: method.

Return Value

a flow object to be used for creating a dynamic form.

Discussion

Create a flow object which launches a single FAQ when tapped. Refer to showSingleFAQ: for more details.

Declared In

HelpshiftSupport.h

+ flowToShowNestedDynamicFormWithFlows:withDisplayText:

Use this method to nest a dynamic form within another dynamic form. Basically this method takes a list of ‘flows’ and combines them into a single ‘flow’ (the next dynamic form).

+ (id)flowToShowNestedDynamicFormWithFlows:(NSArray *)nextDynamicFormFlows withDisplayText:(NSString *)displayText

Parameters

nextDynamicFormFlows

A list of ‘flow’ objects that will show up as the next dynamic form when this flow is tapped.

displayText

Text to be displayed in the row.

Return Value

a flow object to be used for creating a dynamic form.

Discussion

Use this method to nest a dynamic form within another dynamic form. Basically this method takes a list of ‘flows’ and combines them into a single ‘flow’ (the next dynamic form).

Declared In

HelpshiftSupport.h

+ flowToPerformCustomActionOnTarget:andSelector:withOptionalObject:withDisplayText:

Use this method to create a flow that performs a custom action when tapped.

+ (id)flowToPerformCustomActionOnTarget:(id)target andSelector:(SEL)selector withOptionalObject:(id)optionalObject withDisplayText:(NSString *)displayText

Parameters

target

The target on which the selector will be called.

selector

The selector that needs to be invoked.

displayText

Text to be displayed in the row.

object

An optional object that needs to be passed to the selector.

Return Value

a flow object.

Discussion

Use this method to create a flow that performs a custom action when tapped.

Declared In

HelpshiftSupport.h