Helpshift APIs

Open Widget

If you want to open the conversation window at any time (apart from an explicit user click on launcher button), you 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 to the Embed Code. All of the widget specific options go here.

(function () {
  // The following part remains as it is in the Embed Code.
  // 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 go here.
  };
  /* Widget Options End */
}) ();

Enable Fullscreen View for Pop-ups

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

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

On mobile devices, the widget always opens in full-screen mode.

Show/Hide Launcher

You can hide the default launcher and use your own launcher. You can control opening and closing of the conversation window using the open and close APIs. Add the following option in widgetOptions to hide the default launcher.

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

Widget Position

To set the widget's position, provide the position option in widgetOptions. Values allowed for position are:

  • bottom-right
  • bottom-left
  • top-left
  • top-right

The default value is bottom-right.

helpshiftConfig.widgetOptions = {
  // ...
  position: "bottom-left"
};

Widget z-index

By default, Web Chat assigns a large z-index value to its widget (the launcher and conversation window). If you want to use a custom value of z-index for Web Chat, you can do so by setting the zIndex option in widgetOptions. You can only use a number with this option.

helpshiftConfig.widgetOptions = {
  // ...
  zIndex: 50
};

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. You can use the addEventListener and removeEventListener APIs to manage the events.

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.

The "Close" button is visible only for chat flows where the setInitialUserMessage API is used.

Adding the chatEnd event handler

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

Removing the chatEnd event handler

Helpshift("removeEventListener", "chatEnd");