public class

Support

extends Object
java.lang.Object
   ↳ com.helpshift.support.Support

Summary

Nested Classes
interface Support.Delegate A delegate which defines the session callbacks which are available in the SDK. 
class Support.EnableContactUs

Constants to specify the possible options for enableContactUs flag

Following are the possible values

ALWAYS - User will always be shown the Contact Us option;

NEVER - User will never be shown the Contact Us option;

AFTER_VIEWING_FAQS - User can see the Contact Us option only after he has viewed FAQ;

AFTER_MARKING_ANSWER_UNHELPFUL - User can see the Contact US option only after he has marked a question unhelpful;

 

class Support.RateAlert

Constants to describe the action taken by the user inside the Alert Dialog to Rate App. 

Constants
String CustomMetadataKey (Optional) A Reserved key constant to be used; to add custom metadata to the config HashMap.
String IssueTagsKey This constant is deprecated. As of release 3.0.1, replaced by TagsKey
String TagsKey A Reserved key constant to be used with setMetadataCallback to pass String array which get interpreted at server and added as Tags for the conversation submitted.
String UserAcceptedTheSolution
String UserRejectedTheSolution
String UserReviewedTheApp
String UserSentScreenShot
Public Methods
static void clearBreadCrumbs()
Clears Breadcrumbs list.
static SupportFragment getConversationFragment(Activity activity, Map config)
You can use this API to get an embeddable SupportFragment with the provided config, which can be used in your Activity to show the conversations screen.
static SupportFragment getConversationFragment(Activity activity)
You can use this API to get an embeddable SupportFragment which can be used in your Activity to show the conversations screen.
static SupportFragment getDynamicFormFragment(Activity activity, List<Flow> flowList)
This will return a Dynamic form embeddable "SupportFragment".
static SupportFragment getDynamicFormFragment(Activity activity, List<Flow> flowList, Map config)
This will return a Dynamic form embeddable "SupportFragment".
static SupportFragment getFAQSectionFragment(Activity activity, String sectionPublishId, Map config)
You can use this API to get an embeddable SupportFragment with the provided config, which can be used in your Activity to show a FAQ section with the provided section publish id.
static SupportFragment getFAQSectionFragment(Activity activity, String sectionPublishId)
You can use this API to get an embeddable SupportFragment which can be used in your Activity to show a FAQ section with the provided section publish id.
static SupportFragment getFAQsFragment(Activity activity, Map config)
You can use this API to get an embeddable SupportFragment with the provided config, which can be used in your Activity to show all FAQs.
static SupportFragment getFAQsFragment(Activity activity)
You can use this API to get an embeddable SupportFragment which can be used in your Activity to show all FAQs.
static Support getInstance()
static void getNotificationCount(Handler success, Handler failure)
Gets notification count asynchronously by implementing the countHandler and failHandler.
static Integer getNotificationCount()
Gets notification count synchronously.
static SupportFragment getSingleFAQFragment(Activity activity, String questionPublishId, Map config)
You can use this API to get an embeddable SupportFragment with the provided config, which can be used in your Activity to show a Single FAQ with the provide question publish id.
static SupportFragment getSingleFAQFragment(Activity activity, String questionPublishId)
You can use this API to get an embeddable SupportFragment which can be used in your Activity to show a Single FAQ with the provide question publish id.
static void leaveBreadCrumb(String breadCrumb)
Adds additonal debugging information in your code.
static void setDelegate(Support.Delegate delegate)
Set the session delegate for Support
static void setMetadataCallback(Callable f)
Provide a function to fetch custom data.
static void setSDKLanguage(String locale)
Set the SDK language for the given locale.
static void setUserIdentifier(String userIdentifier)
(Optional) If you already have identification for your users, you can specify that as well.
static void showAlertToRateApp(String url, AlertToRateAppListener alertToRateAppListener)
Display an alert dialog, which prompts the user to rate your app, or send feedback.
static void showConversation(Activity a, Map config)
You can use this api call to provide a way for the user to send feedback or start a new conversation with you.
static void showConversation(Activity a)
You can use this api call to provide a way for the user to send feedback or start a new conversation with you.
static void showDynamicForm(Activity activity, List<Flow> flowList)
This will show the Dynamic Form screen to facilitate Guided ticket filing.
static void showFAQSection(Activity a, String sectionPublishId, Map config)
Shows FAQ section activity with Config.
static void showFAQSection(Activity a, String sectionPublishId)
Shows FAQ section activity.
static void showFAQs(Activity a)
Shows faqs activity.
static void showFAQs(Activity a, Map config)
Shows faqs activity.
static void showSingleFAQ(Activity a, String questionPublishId, Map config)
Shows question activity with Config.
static void showSingleFAQ(Activity a, String questionPublishId)
Shows question activity.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String CustomMetadataKey

(Optional) A Reserved key constant to be used; to add custom metadata to the config HashMap. This metadata is sent to the server when the user starts a new conversation.

Constant Value: "hs-custom-metadata"

public static final String IssueTagsKey

This constant is deprecated.
As of release 3.0.1, replaced by TagsKey

A Reserved key constant to be used with setMetadataCallback to pass String array which get interpreted at server and added as Tags for the conversation submitted.

Constant Value: "hs-tags"

public static final String TagsKey

A Reserved key constant to be used with setMetadataCallback to pass String array which get interpreted at server and added as Tags for the conversation submitted.

Constant Value: "hs-tags"

public static final String UserAcceptedTheSolution

Constant Value: "User accepted the solution"

public static final String UserRejectedTheSolution

Constant Value: "User rejected the solution"

public static final String UserReviewedTheApp

Constant Value: "User reviewed the app"

public static final String UserSentScreenShot

Constant Value: "User sent a screenshot"

Public Methods

public static void clearBreadCrumbs ()

Clears Breadcrumbs list.

Breadcrumbs list stores upto 100 latest actions. You'll receive those in every Issue. But if for reason you want to clear previous messages (On app load, for eg), you can do that by calling following function.

 Support.clearBreadCrumbs ();

public static SupportFragment getConversationFragment (Activity activity, Map config)

You can use this API to get an embeddable SupportFragment with the provided config, which can be used in your Activity to show the conversations screen.

Parameters
activity Your activity from which you call this API.
config Extra config
Returns
  • Embeddable Conversation SupportFragment

public static SupportFragment getConversationFragment (Activity activity)

You can use this API to get an embeddable SupportFragment which can be used in your Activity to show the conversations screen.

Parameters
activity Your activity from which you call this API.
Returns
  • Embeddable Conversation SupportFragment

public static SupportFragment getDynamicFormFragment (Activity activity, List<Flow> flowList)

This will return a Dynamic form embeddable "SupportFragment".

Parameters
activity Activity
flowList Your list of flows.
Returns
  • Dynamic form embeddable SupportFragment.

public static SupportFragment getDynamicFormFragment (Activity activity, List<Flow> flowList, Map config)

This will return a Dynamic form embeddable "SupportFragment". When using a standalone toolbar, provide the toolbar id inside the config map as "toolbarId".

Parameters
activity Activity
flowList Your list of flows.
config Config containing toolbar id.
Returns
  • Dynamic form embeddable SupportFragment.

public static SupportFragment getFAQSectionFragment (Activity activity, String sectionPublishId, Map config)

You can use this API to get an embeddable SupportFragment with the provided config, which can be used in your Activity to show a FAQ section with the provided section publish id.

Parameters
activity Your activity from which you call this API.
sectionPublishId Id specifying a section.
config Extra config
Returns
  • Embeddable single FAQ section SupportFragment

public static SupportFragment getFAQSectionFragment (Activity activity, String sectionPublishId)

You can use this API to get an embeddable SupportFragment which can be used in your Activity to show a FAQ section with the provided section publish id.

Parameters
activity Your activity from which you call this API.
sectionPublishId Id specifying a section.
Returns
  • Embeddable single FAQ section SupportFragment

public static SupportFragment getFAQsFragment (Activity activity, Map config)

You can use this API to get an embeddable SupportFragment with the provided config, which can be used in your Activity to show all FAQs.

Parameters
activity Your activity from which you call this API.
config Extra config
Returns
  • Embeddable all FAQs SupportFragment

public static SupportFragment getFAQsFragment (Activity activity)

You can use this API to get an embeddable SupportFragment which can be used in your Activity to show all FAQs.

Parameters
activity Your activity from which you call this API.
Returns
  • Embeddable all FAQs SupportFragment

public static Support getInstance ()

public static void getNotificationCount (Handler success, Handler failure)

Gets notification count asynchronously by implementing the countHandler and failHandler. The notification count can be obtained from the message received though the countHandler. Example:-

 private Handler countHandler = new Handler() {
 public void handleMessage(Message msg) {
 super.handleMessage(msg);
 Bundle countData = (Bundle) msg.obj;
 Integer count = countData.getInt("value");
 Boolean cache = countData.getBoolean("cache");
 if (cache) {
 Log.d("Notification Count", "local" + count);
 } else {
 Log.d("Notification Count", "server" + count);
 }
 }
 };
 Support.getNotificationCount(countHandler, new Handler());

Parameters
success Success handler
failure Failure handler

public static Integer getNotificationCount ()

Gets notification count synchronously.

Ex:-

 Integer notifCount = Support.getNotificationCount();

public static SupportFragment getSingleFAQFragment (Activity activity, String questionPublishId, Map config)

You can use this API to get an embeddable SupportFragment with the provided config, which can be used in your Activity to show a Single FAQ with the provide question publish id.

Parameters
activity Your activity from which you call this API.
questionPublishId Id specifying a question.
config Extra config
Returns
  • Embeddable single FAQ SupportFragment

public static SupportFragment getSingleFAQFragment (Activity activity, String questionPublishId)

You can use this API to get an embeddable SupportFragment which can be used in your Activity to show a Single FAQ with the provide question publish id.

Parameters
activity Your activity from which you call this API.
questionPublishId Id specifying a question.
Returns
  • Embeddable single FAQ SupportFragment

public static void leaveBreadCrumb (String breadCrumb)

Adds additonal debugging information in your code.

You can add additional debugging statements to your code, and see exactly what the user was doing right before they started a new conversation.

 Support.leaveBreadCrumb("Went to Preferences Screen");

Parameters
breadCrumb Action/Message to add to bread-crumbs list.

public static void setDelegate (Support.Delegate delegate)

Set the session delegate for Support

Parameters
delegate The Delegate object.

public static void setMetadataCallback (Callable f)

Provide a function to fetch custom data.

 import com.helpshift.Callable;
 

String [] tags = new String [] ("hello", "world");

HashMap k = new HashMap(); k.put ("foo", "bar"); k.put ("baz", "qux"); k.put (SUpport.TagsKey, tags);

Support.setMetadataCallback (new Callable (){ public HashMap call() { return k; } });

Parameters
f Callbale object with call method implemented.

public static void setSDKLanguage (String locale)

Set the SDK language for the given locale. Locale can contain two-letter lowercase ISO language codes (such as "en") as defined by ISO 639-1 and in addition contain two-letter uppercase ISO country codes (such as "US") as defined by ISO 3166-1. Language code and country code are separated by an underscore ("_"). Example - "pt_BR", "zh_CN".



Example - Setting SDK language for the given locale with only language code.

 Support.setSDKLanguage("fr");
 

Example - Setting the SDK language for the given locale with both language code and country code.

 Support.setSDKLanguage("zh_CN");
 

Parameters
locale locale contains either language code or both language code and country code.

public static void setUserIdentifier (String userIdentifier)

(Optional) If you already have identification for your users, you can specify that as well.

For example:

 Support.setUserIdentifier("user-id-100");

Parameters
userIdentifier A custom user Identifier.

public static void showAlertToRateApp (String url, AlertToRateAppListener alertToRateAppListener)

Display an alert dialog, which prompts the user to rate your app, or send feedback. The alertview is not shown if a conversation is currently running with the user or if you give a null/invalid url. Example:

 String playStoreUrl = "market://details?id=<package_name>";
 AlertToRateAppListener actionListener =  new AlertToRateAppListener() {
 @Override
 public void onAction(Support.RATE_ALERT action) {
 String msg = "";
 switch (action) {
 case CLOSE:
 msg = "Close";
 break;
 case FEEDBACK:
 msg = "Feedback";
 break;
 case SUCCESS:
 msg = "Rate app";
 break;
 case FAIL:
 msg = "Alert did not show";
 break;
 }
 Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
 }
 };
 Support.showAlertToRateApp(playStoreUrl, actionListener);

Parameters
url Android application link.
alertToRateAppListener The callback which will run onAction.

public static void showConversation (Activity a, Map config)

You can use this api call to provide a way for the user to send feedback or start a new conversation with you.

For Example:-

 HashMap customMetadata = new HashMap();
 customMetadata.put("usertype", "paid");
 customMetadata.put("level", "7");
 customMetadata.put("score", "12345");
 

contactUsBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { HashMap config = new HashMap (); config.put("gotoConversationAfterContactUs", true); config.put("requireEmail", true); config.put(Support.CustomMetadataKey, customMetadata); Support.showConversation(MyActivity.this, config); } });

Following flags are supported in this config -

  1. gotoConversationAfterContactUs (Default : false) If set to true. Support SDK will land on conversation activity after starting a new conversation. If set to false Support SDK will land on last activity before starting a new conversation.
  2. requireEmail (Default : false) If requireEmail flag is set to true, an e-mail address is required while starting a new conversation. Default value is false i.e. e-mail is optional.
  3. conversationPrefillText The conversationPrefillText API option will pre-fill a new conversation description, with the supplied string. This is useful where you might want your users to send you diagnostic information in the conversation description, for example if the app hits an exception, etc Applicable only in the showConversation API
  4. hideNameAndEmail (Default : false) If hideNameAndEmail flag is set to true, the Name and Email field will not be shown in the new conversation form. If the name and email are set via API, they will be sent along with the issue. Default value is false i.e Name and Email fields are shown
  5. enableFullPrivacy (Default : false) If enableFullPrivacy flag is set to true, no private data will be sent which can be used to identify a user. This helps developers ensure full COPPA compliance. Default value is false i.e all user data will be sent
  6. showSearchOnNewConversation (Default : false) If showSearchOnNewConversation flag is set to true, the user will be taken to a view which shows the search results for the conversation text that he has entered. This is to avoid tickets which are already answered in the FAQs. The user will still be able to start a new conversation with the same text. Alternatively he can go through one of the FAQs and find a solution to his query. Default value is false i.e no search after Send button is pressed

Parameters
a The Activity from which you call showConversation.
config Extra config.

public static void showConversation (Activity a)

You can use this api call to provide a way for the user to send feedback or start a new conversation with you.

For Example:-

 contactUsBtn.setOnClickListener(new OnClickListener() {
 @Override
 public void onClick(View view) {
 Support.showConversation(MyActivity.this);
 }
 });
 

Parameters
a The Activity from which you call showConversation.

public static void showDynamicForm (Activity activity, List<Flow> flowList)

This will show the Dynamic Form screen to facilitate Guided ticket filing.

Parameters
activity Activity
flowList Your list of flows.

public static void showFAQSection (Activity a, String sectionPublishId, Map config)

Shows FAQ section activity with Config.

This will show a FAQ section view with list of questions in that section. The search inside this view will be limited to the specified section. You can specify a section using publish ID of that section.

For example, this can be triggered on the onClick of showFAQSectionBtn Button

 HashMap customMetadata = new HashMap();
 customMetadata.put("usertype", "paid");
 customMetadata.put("level", "7");
 customMetadata.put("score", "12345");
 

showFAQSectionBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { HashMap config = new HashMap (); config.put("gotoConversationAfterContactUs", false); config.put("enableContactUs", Support.ENABLE_CONTACT_US.NEVER); config.put("requireEmail", true); config.put(Support.CustomMetadataKey, customMetadata); Support.showFAQSection(MyActivity.this, "1", config); } });

Following flags are supported in this config -

  1. gotoConversationAfterContactUs (Default : false) If set to true. Support SDK will land on conversation activity after starting a new conversation. If set to false Support SDK will land on last activity before starting a new conversation.
  2. enableContactUs (Default : Support.ENABLE_CONTACT_US.ALWAYS) The enableContactUs flag will determine whether the Contact Us button is shown. The default value is Support.ENABLE_CONTACT_US.ALWAYS.
  3. requireEmail (Default : false) If requireEmail flag is set to true, an e-mail address is required while starting a new conversation. Default value is false i.e. e-mail is optional.
  4. hideNameAndEmail (Default : false) If hideNameAndEmail flag is set to true, the Name and Email field will not be shown in the new conversation form. If the name and email are set via API, they will be sent along with the issue. Default value is false i.e Name and Email fields are shown
  5. enableFullPrivacy (Default : false) If enableFullPrivacy flag is set to true, no private data will be sent which can be used to identify a user. This helps developers ensure full COPPA compliance. Default value is false i.e all user data will be sent
  6. showSearchOnNewConversation (Default : false) If showSearchOnNewConversation flag is set to true, the user will be taken to a view which shows the search results for the conversation text that he has entered. This is to avoid tickets which are already answered in the FAQs. The user will still be able to start a new conversation with the same text. Alternatively he can go through one of the FAQs and find a solution to his query. This flag will be ignored if the user has conducted any search or if user is filing the issue from Question screen Default value is false i.e no search after Send button is pressed

Parameters
a The Activity from which you show section activity.
sectionPublishId Id specifying a section.
config Additional config.

public static void showFAQSection (Activity a, String sectionPublishId)

Shows FAQ section activity.

This will show a FAQ section view with list of questions in that section. The search inside this view will be limited to the specified section. You can specify a section using publish ID of that section.

For example, this can be triggered on the onClick of showFAQSectionBtn Button

 showFAQSectionBtn.setOnClickListener(new OnClickListener() {
 @Override
 public void onClick(View view) {
 Support.showFAQSection(MyActivity.this, "1");
 }
 });
 

Parameters
a The Activity from which you show section activity.
sectionPublishId Id specifying a section.

public static void showFAQs (Activity a)

Shows faqs activity. This will show list of sections with search.

 showFaqsBtn.setOnClickListener(new OnClickListener() {
 @Override
 public void onClick(View view) {
 Support.showFAQs(MyActivity.this);
 }
 });
 

Parameters
a The Activity from which you call show faqs activity.

public static void showFAQs (Activity a, Map config)

Shows faqs activity. This will show list of sections with search.

 HashMap customMetadata = new HashMap();
 customMetadata.put("usertype", "paid");
 customMetadata.put("level", "7");
 customMetadata.put("score", "12345");
 

showFaqsBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { HashMap config = new HashMap (); config.put("gotoConversationAfterContactUs", true); config.put("enableContactUs", Support.ENABLE_CONTACT_US.ALWAYS); config.put("requireEmail", true); config.put(Support.CustomMetadataKey, customMetadata); Support.showFAQs(MyActivity.this, config); } });

Following flags are supported in this config -

  1. gotoConversationAfterContactUs (Default : false) If set to true. Support SDK will land on conversation activity after starting a new conversation. If set to false Support SDK will land on last activity before starting a new conversation.
  2. enableContactUs (Default : Support.ENABLE_CONTACT_US.ALWAYS) The enableContactUs flag will determine whether the Contact Us button is shown. The default value is Support.ENABLE_CONTACT_US.ALWAYS.
  3. requireEmail (Default : false) If requireEmail flag is set to true, an e-mail address is required while starting a new conversation. Default value is false i.e. e-mail is optional.
  4. hideNameAndEmail (Default : false) If hideNameAndEmail flag is set to true, the Name and Email field will not be shown in the new conversation form. If the name and email are set via API, they will be sent along with the issue. Default value is false i.e Name and Email fields are shown
  5. enableFullPrivacy (Default : false) If enableFullPrivacy flag is set to true, no private data will be sent which can be used to identify a user. This helps developers ensure full COPPA compliance. Default value is false i.e all user data will be sent
  6. showSearchOnNewConversation (Default : false) If showSearchOnNewConversation flag is set to true, the user will be taken to a view which shows the search results for the conversation text that he has entered. This is to avoid tickets which are already answered in the FAQs. The user will still be able to start a new conversation with the same text. Alternatively he can go through one of the FAQs and find a solution to his query. This flag will be ignored if the user has conducted any search or if user is filing the issue from Question screen Default value is false i.e no search after Send button is pressed

Parameters
a The Activity from which you call show faqs activity.
config Extra config.

public static void showSingleFAQ (Activity a, String questionPublishId, Map config)

Shows question activity with Config.

This provides show question view provided a publish id of that section. For example, this can be triggered on the onClick of showSingleFAQBtn Button.

 HashMap customMetadata = new HashMap();
 customMetadata.put("usertype", "paid");
 customMetadata.put("level", "7");
 customMetadata.put("score", "12345");
 

showSingleFAQBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { HashMap config = new HashMap (); config.put("gotoConversationAfterContactUs", false); config.put("enableContactUs", Support.ENABLE_CONTACT_US.NEVER); config.put("requireEmail", true); config.put(Support.CustomMetadataKey, customMetadata); Support.showSingleFAQ(MyActivity.this, "1", config); } });

Following flags are supported in this config -

  1. gotoConversationAfterContactUs (Default : false) If set to true. Support SDK will land on conversation activity after starting a new conversation. If set to false Support SDK will land on last activity before starting a new conversation.
  2. enableContactUs (Default : Support.ENABLE_CONTACT_US.ALWAYS) The enableContactUs flag will determine whether the Contact Us button is shown. The default value is Support.ENABLE_CONTACT_US.ALWAYS.
  3. requireEmail (Default : false) If requireEmail flag is set to true, an e-mail address is required while starting a new conversation. Default value is false i.e. e-mail is optional.
  4. hideNameAndEmail (Default : false) If hideNameAndEmail flag is set to true, the Name and Email field will not be shown in the new conversation form. If the name and email are set via API, they will be sent along with the issue. Default value is false i.e Name and Email fields are shown
  5. enableFullPrivacy (Default : false) If enableFullPrivacy flag is set to true, no private data will be sent which can be used to identify a user. This helps developers ensure full COPPA compliance. Default value is false i.e all user data will be sent

Parameters
a The Activity from which you call show question activity.
questionPublishId Id specifying a section.
config Additional config.

public static void showSingleFAQ (Activity a, String questionPublishId)

Shows question activity.

This provides show question view provided a publish id of that section. For example, this can be triggered on the onClick of showSingleFAQBtn Button.

 showSingleFAQBtn.setOnClickListener(new OnClickListener() {
 @Override
 public void onClick(View view) {
 Support.showSingleFAQ(MyActivity.this, "1");
 }
 });
 

Parameters
a The Activity from which you call show question activity.
questionPublishId Id specifying a section.