@brainfi.sh/chat-widget
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

Brainfish Chat Widget

This is a simple chat widget that can be embedded on any website. It is built using SolidJS and Socket.io.

Installation

npm install @branfi.sh/chat-widget

Directly in your HTML

<script type="module">
  import ChatWidget from 'https://cdn.jsdelivr.net/npm/@branfi.sh/chat-widget'

  ChatWidget.initStandard({
    chatAppId: 'YOUR_CHAT_APP_ID',
  })
</script>

<brainfish-standard-widget style="width: 100%; height: 600px; "></brainfish-standard-widget>

Popup

You can get the popup HTML and Javascript code by clicking on the "HTML & Javascript" button in the "Share" tab of your typebot.

Here is an example:

<script type="module">
  import ChatWidget from 'https://cdn.jsdelivr.net/npm/@branfi.sh/chat-widget/dist/web.js'

  ChatWidget.initPopup({
    chatAppId: 'YOUR_CHAT_APP_ID',
    autoShowDelay: 3000,
  })
</script>

This code will automatically trigger the popup window after 3 seconds.

Open or Close a popup

You can use these commands:

ChatWidget.open()
ChatWidget.close()
ChatWidget.toggle()

You can bind these commands on a button element, for example:

<button onclick="ChatWidget.open()">Contact us</button>

Bubble

You can get the bubble HTML and Javascript code by clicking on the "HTML & Javascript" button in the "Share" tab of your typebot.

Here is an example:

<script type="module">
  import ChatWidget from 'https://cdn.jsdelivr.net/npm/@branfi.sh/chat-widget/dist/web.js'

  ChatWidget.initBubble({
    chatAppId: 'YOUR_CHAT_APP_ID',
    theme: {
      button: { backgroundColor: '#0042DA', iconColor: '#FFFFFF' },
      chatWindow: { backgroundColor: '#ffffff' },
    },
  })
</script>

This code will show the bubble and let a preview message appear after 5 seconds.

Open or close the typebot

You can use these commands:

ChatWidget.open()
ChatWidget.close()
ChatWidget.toggle()

You can bind these commands on a button element, for example:

<button onclick="ChatWidget.open()">Contact us</button>

Readme

Keywords

none

Package Sidebar

Install

npm i @brainfi.sh/chat-widget

Weekly Downloads

48

Version

0.0.7

License

none

Unpacked Size

7.91 MB

Total Files

50

Last publish

Collaborators

  • ajainvivek