0.0.60 • Published 2 years ago

@brainfish-ai/chat-widget v0.0.60

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

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 @branfish-ai/chat-widget

Directly in your HTML

<script type="module">
  import ChatWidget from 'https://cdn.jsdelivr.net/npm/@branfish-ai/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/@branfish-ai/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/@branfish-ai/chat-widget/dist/web.js";

  ChatWidget.initBubble({
    chatAppId: "YOUR_CHAT_APP_ID",
    previewMessage: {
      message: "Need help?",
      autoShowDelay: 5000,
      avatarUrl: "https://cdn-icons-png.flaticon.com/512/1587/1587565.png",
    },
    theme: {
      button: { backgroundColor: "#0042DA", iconColor: "#FFFFFF" },
      chatWindow: { backgroundColor: "#ffffff" },
    },
    settings: {
      languageSelector: {
        isEnabled: true,
      },
    },
  });
</script>

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

Open or close the preview message

You can use these commands:

ChatWidget.showPreviewMessage();
ChatWidget.hidePreviewMessage();

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>
0.0.40

2 years ago

0.0.41

2 years ago

0.0.42

2 years ago

0.0.43

2 years ago

0.0.44

2 years ago

0.0.45

2 years ago

0.0.46

2 years ago

0.0.47

2 years ago

0.0.37

2 years ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.60

2 years ago

0.0.59

2 years ago

0.0.51

2 years ago

0.0.52

2 years ago

0.0.53

2 years ago

0.0.54

2 years ago

0.0.55

2 years ago

0.0.56

2 years ago

0.0.57

2 years ago

0.0.58

2 years ago

0.0.50

2 years ago

0.0.48

2 years ago

0.0.49

2 years ago

0.0.30

2 years ago

0.0.31

2 years ago

0.0.32

2 years ago

0.0.33

2 years ago

0.0.34

2 years ago

0.0.35

2 years ago

0.0.36

2 years ago

0.0.27

2 years ago

0.0.29

2 years ago

0.0.26

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago