tarka-chat

Tarka Chat UI

Tarka Chat UI is a plug and play javascript library to integrate a chat assistant to your website in one line

Usage

  1. Include the following script (hosted in CDN) in your html
<script src="https://d1fmfone96g0x2.cloudfront.net/tarka-chat-2.4.0.umd.js"></script>

Include highcharts library to generate charts by highcharts

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
  1. Initialise the global TarkaChat component with options in any script tag
TarkaChat.init({
        title: "Personal Assistant",
        botName: "superbot",
        greeting: "Welcome. How can I assist you today?",
        themeColor: "#F0DAFB",
        selectorId: "chatbot",
        expand: true,
        enableUpload: true,
        preChatRenderer: function (onClose) {
          // Return a DOM Node that can be attached to the chatbot UI
          // Use the onClose callback to close the pre-chat screen
          const button = document.createElement("button");
          button.innerText = "Close pre-chat";
          button.addEventListener("click", onClose);
          return button;
        },
        submitHandler: async function (message) {
          // Do API calls
          // after getting response return the response string
          return Promise.resolve("Recieved response");
        },
      });

where,

Demo

Demo is deployed from the application code in demo/ folder. Link: https://tarkalabs.github.io/tarka-chat/demo/

All versions

Dev notes

If you wanted to run this code in your local for development purposes, Run the following command from project root folder yarn dev and open dev/index.html in your browser to see the chat window. Your local changes will be hot reloaded

Releasing new version

Maintainers can release a new version of tarka chat by running the github action release. This will push a new release into our CDN based on the version in the package.json file and creates a new github release