@denserai/embed-chat
TypeScript icon, indicating that this package has built-in type declarations

1.0.16 • Public • Published

Denserbot Embed

Javascript library to display denserbot on your website

Run locally

Install

pnpm install

Develop

pnpm dev

Build

pnpm build

Embed in your HTML

Add the following code to your HTML file:

<script type="module">
  import Chatbot from 'https://cdn.jsdelivr.net/npm/@denserai/embed-chat@1/dist/web.min.js';
  Chatbot.init({
    chatbotId: '<chatbotId>',
    initMessages: ['Hello', 'How can I help you?'],
  });
</script>

Replace <chatbotId> with your chatbot id.

Options

Here are the options you can pass to the init function:

  • chatbotId: The chatbot id
  • apiHost: The API host (default: https://denser.ai)
  • theme: theme object
    • theme.darkMode: The dark mode (default: false)
    • theme.button.size: The button size medium or large (default: medium)
    • theme.button.backgroundColor: The button color (default: white)
    • theme.button.color: The button text color (default: black)
    • theme.button.bottom: The button bottom position (default: 20px)
    • theme.button.right: The button right position (default: 20px)
    • theme.chatWindow.backgroundColor: The chat window background color (default: white)
    • theme.chatWindow.width: The chat window width (default: undefined)
    • theme.chatWindow.height: The chat window height (default: calc(100% - 100px))
  • initMessages: The initial messages to display when the chatbot is opened (eg: ['Hello', 'How can I help you?'])

Example:

<script type="module">
  import Chatbot from 'https://cdn.jsdelivr.net/npm/@denserai/embed-chat@1/dist/web.min.js';
  Chatbot.init({
    chatbotId: '<chatbotId>',
    theme: {
      button: {
        size: 'large',
        backgroundColor: 'black',
        color: 'white',
        bottom: '20px',
        right: '20px',
      },
      chatWindow: {
        backgroundColor: 'white',
        width: '400px',
        height: 'calc(100% - 100px)',
      },
    },
    initMessages: ['Hello', 'How can I help you?'],
  });
</script>

How to Release

First, update the version:

npm version patch

Then, create a new tag and push it:

git tag v1.x.x
git push origin v1.x.x

Finally, create a new release on GitHub and the publish will be done automatically.

How to purge the CDN

Purge with API (make sure your have access to the API)

curl -X PURGE https://purge.jsdelivr.net/npm/@denserai/embed-chat@1/dist/web.min.js

Purge with the web interface

Go to the following link and purge the file:

https://www.jsdelivr.com/tools/purge

Readme

Keywords

none

Package Sidebar

Install

npm i @denserai/embed-chat

Weekly Downloads

3

Version

1.0.16

License

MIT

Unpacked Size

121 kB

Total Files

51

Last publish

Collaborators

  • jotyyy