Helpshift APIs

Reset Timeout

Reset timeout denotes the number of hours of inactivity after which the conversation resets. The default value is 12 hours. But if you want to reduce or increase the timeout, you can change it by mentioning the value in helpshiftConfig at the time of initialization.

For example:

// Make this change to the embed code placed before the closing </body> tag.

window.helpshiftConfig = {
  platformId: "<YOUR_APP_ID>",
  domain: "<YOUR_DOMAIN>",
  resetTimeout: 24 // Example: 24 hours
};

Reset Conversation

The default use case for the Helpshift Web Chat is a “public” use case. This means that Helpshift does not clear the chat immediately, and the conversation can persist until the timeout. But if you wish to support a logged-in use case, they can reset the conversation by calling the following API when the user logs out.

Helpshift("reset");

Open Widget

If you want to open the conversation window at any time (apart from an explicit user click on launcher button), they can do it by calling the following API. This could be useful for triggering proactive help.

Helpshift("open");

Close Widget

Similarly, for closing the conversation window at any time, you can call the following API.

Helpshift("close");

Widget Options

To configure the widget's behavior, you'll need to add widgetOptions into your embed script. All of the widget specific options will go in here.

(function () {
  // The following part remains as it is in the embed script.
  // Please check the part after "Widget Options Start"
  var PLATFORM_ID = "<YOUR_PLATFORM_ID>",
      DOMAIN = "<YOUR_DOMAIN>";

  window.helpshiftConfig = {
    platformId: PLATFORM_ID,
    domain: DOMAIN
  };

  /* Widget Options Start */
  helpshiftConfig.widgetOptions = {
    // All widget specific options will go here.
  };
  /* Widget Options End */
}) ();

Enable Fullscreen View for Pop-ups

If you want to open the widget in full screen mode in any non-mobile device, you can pass through the fullScreen option in widgetOptions.

helpshiftConfig.widgetOptions = {
  // ...
  fullScreen: true
};

As the display is small on mobile, the widget will always open in full-screen mode.

Show/Hide Launcher

You can hide the default launcher and use your own launcher using widget's open and close APIs by adding the following property in widgetOptions.

helpshiftConfig.widgetOptions = {
  // ...
  showLauncher: false
};

Set Initial User Message

If you want to set the initial user message through an API rather than making the end user type it, you can use the following API.

var userMessage = "Hello, how can I track my order?"
Helpshift("setInitialUserMessage", userMessage);

Events

The Helpshift widget fires the following events across different scenarios.

Chat End Event

This event gets fired when the user clicks on the 'close' button after the chat is resolved. To listen to this event, add the following code after the embed code.

var chatEndHandler = function() {
  console.log("Chat ended");
};
Helpshift("addEventListener", "chatEnd", chatEndHandler);