How to deploy a bot on my website?

Introduction

The Haptik JavaScript SDK is a completely modular conversational interface. It renders a complete chat experience that can be easily integrated across different web environments.

The footprint is tiny, it supports SSL, and works asynchronously – so it won’t block your website.

Prerequisites

Before Integrating the SDK make sure you have these:

  • Business ID
  • Client ID
  • Base URL

You can acquire the above by simply clicking on the share bot option on your bot, as shown.

Installation

The installation is a fairly simple process. Add the following script at the bottom of the HTML page before the closing tag.

<script>
    window.haptikInitSettings = {
    "business-id": "<business-id>",
    "client-id": "<client-id>",
    "base-url": "<base-url>",
    };
</script>
<script
    type="text/javascript"
    charset="UTF-8"
    src="https://toolassets.haptikapi.com/platform/javascript-xdk/production/loader.js"
></script>

Complete Example

<!DOCTYPE html>
<html>
    <head>
    <title>Haptik JS SDK Integration Demo</title>
    <meta charset="UTF-8" />
    <meta content="width=device-width; initial-scale=1.0;" name="viewport" />
    </head>
    <body>
    ...Some HTML Code Snippet...
    <script>
    window.haptikInitSettings = {
    "business-id": "<business-id>",
    "client-id": "<client-id>",
    "base-url": "<base-url>",
    };
    </script>
    <script
    type="text/javascript"
    charset="UTF-8"
    src="https://toolassets.haptikapi.com/platform/javascript-xdk/production/loader.js"
    ></script>
    </body>
</html>

Ensure <meta charset="UTF-8" /> tag is added in the source code. In case it is not added, you might see some encoded or gibberish text on the bot.

Sending Notifications in a Bot with Web SDK Integration

If you integrate your bot into an Android or iOS app using Web SDK then it is not possible to send push notifications out of the box. In such cases, if you want to send push notifications you can use the Web SDK settings from the platform deployments page.

Setting up notifications

  • Go to the Platform Settings page and scroll to the Web SDK section.
  • The callback URL is auto-populated. This is a unique identifier for your business.
  • Then enter the Secret Key which is used to authenticate your business.
  • Finally, enter the Webhook URL. This is the URL the notifications will be sent as a request.
  • Save the configuration and activate it by turning the "Active" toggle on.

Can’t find what you’re looking for? Email us at support@haptik.ai.