New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rigobot-chat-bubble

Package Overview
Dependencies
Maintainers
0
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rigobot-chat-bubble

Rigobot Chat Bubble is a lightweight and customizable chat interface that seamlessly integrates into any website. It allows users to interact with an AI-powered chat agent in real-time, providing a personalized and dynamic user experience.

  • 0.0.69
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
410
decreased by-19.45%
Maintainers
0
Weekly downloads
 
Created
Source

Rigobot Chat Bubble

Rigobot Chat Bubble is a lightweight and customizable chat interface that seamlessly integrates into any website. It allows users to interact with an AI-powered chat agent in real-time, providing a personalized and dynamic user experience.


🚀 Getting Started

To begin using Rigobot Chat Bubble, simply include the script in your HTML file, initialize it with your configurations, and start interacting with your users through the chat interface.


📦 Installation

Add the following script to your HTML file to include Rigobot Chat Bubble:

<script src="https://unpkg.com/rigobot-chat-bubble@0.0.68/dist/main.js"></script>

🛠️ Usage

1️⃣ Initializing the Chat Bubble

To initialize the chat bubble, use the init method with your token and optional settings.

window.rigo.init("YOUR_CHAT_AGENT_HASH", {
  completions: [
    {
      prompt: "What is the name of the Data Science main director?",
      answer: "The Data Science main director is Jenniffer Guzman",
      DOMTarget: "#chat-grow",
    },
  ],
  context: "The user is called: Lulú",
  introVideoUrl: "https://www.youtube.com/watch?v=sg_XoPrwjI0&t=3s",
});

2️⃣ Displaying the Chat Bubble

Use the show method to display the chat bubble. You can customize its position, visibility, and additional settings.

window.rigo.show({
  showBubble: true,
  target: "#chat-grow",
  bubblePosition: {
    top: "10px",
    left: "10px",
  },
  collapsed: false,
  welcomeMessage: "Hello! How can I help you today?",
  user: {
    token: "user-session-token", // Optional, for authenticated users
    nickname: "Lulú",
  },
});

3️⃣ Hiding the Chat Bubble

To hide the chat bubble, use the hide method:

window.rigo.hide();

4️⃣ Dynamically Updating Options

You can update the chat bubble's configuration dynamically using the updateOptions method:

window.rigo.updateOptions({
  context: "The user is now focused on Product XYZ",
  target: "#new-target-element",
});

5️⃣ Listening to Events

Rigobot emits various events that you can listen to and respond to. Use the on method to attach event listeners.

Available Events and Their example Data:
  • open_bubble: Triggered when the bubble is opened.

    {
      when: "2025-01-22T14:00:00Z",
      url: "https://yourwebsite.com",
    }
    
  • close_bubble: Triggered when the bubble is closed.

    {
      when: "2025-01-22T15:00:00Z",
      url: "https://yourwebsite.com",
    }
    
  • outgoing_message: Triggered when the user sends a message to the bot.

    {
      text: "What is your pricing?",
      conversation: { id: "12345", purpose: "sales" },
      messages: [
        { sender: "user", text: "What is your pricing?" },
        { sender: "ai", text: "Our pricing starts at $50/month." },
      ],
      context: "The context sent to the AI",
      when: "2025-01-22T15:03:00Z",
      url: "https://yourwebsite.com",
    }
    
  • incoming_message: Triggered when the bot sends a response to the user.

    {
      text: "Our pricing starts at $50/month.",
      conversation: { id: "12345", purpose: "sales" },
      messages: [
        { sender: "user", text: "What is your pricing?" },
        { sender: "bot", text: "Our pricing starts at $50/month." },
      ],
      when: "2025-01-22T15:03:05Z",
      url: "https://yourwebsite.com",
    }
    
Example of Event Listening:
window.rigo.on("open_bubble", (data) => {
  console.log("Bubble opened:", data);
});

window.rigo.on("incoming_message", (data) => {
  console.log("Bot response received:", data);
});

🌟 Example Implementation

Below is a complete example of how to integrate Rigobot Chat Bubble into your webpage:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Rigobot Chat Bubble</title>
    <script src="https://unpkg.com/rigobot-chat-bubble@0.0.13/dist/main.js"></script>
  </head>
  <body>
    <div id="chat-grow"></div>

    <script>
      document.addEventListener("DOMContentLoaded", function () {
        window.rigo.init("YOUR_CHAT_AGENT_HASH", {
          loglevel: "info",
          purposeSlug: "sales",
          context: "The user is exploring the pricing page",
          introVideo: {
            url: "https://www.youtube.com/watch?v=sg_XoPrwjI0&t=3s",
          },
          completions: [
            {
              prompt: "What are your pricing options?",
              answer: "Our pricing starts at $50/month.",
              DOMTarget: "#chat-grow",
            },
          ],
        });

        window.rigo.show({
          showBubble: true,
          collapsed: false,
          welcomeMessage: "Hi! How can I help you today?",
        });
      });
    </script>
  </body>
</html>

⚙️ Options

Here’s a breakdown of the options you can pass to the init, show, or updateOptions methods:

OptionTypeDescription
loglevel"info"/"debug"Sets logging verbosity level.
showBubblebooleanWhether to display the chat bubble.
collapsedbooleanWhether the chat bubble starts collapsed.
targetstringCSS selector of the element to anchor the chat bubble.
introVideoobject{ url: string } – URL of the introductory video.
welcomeMessagestringMessage to greet the user when the chat loads.
purposeSlugstringIdentifier for the purpose of the chat (e.g., "sales", "support").
completionsarrayArray of { prompt, answer, DOMTarget } objects for pre-configured chat interactions.
contextstringAdditional context to provide to the chat agent.
userobject{ token, nickname, avatar } – Information about the authenticated user (if available).

🧩 Methods

Here are the primary methods available:

MethodDescription
initInitializes Rigobot with a token and options.
showDisplays the chat bubble.
hideHides the chat bubble.
onListens for specific events (e.g., open_bubble, outgoing_message).
updateOptionsDynamically updates chat bubble options.

📜 License

This project is licensed under the MIT License.

Feel free to modify and use Rigobot Chat Bubble to enhance your website's user experience!

FAQs

Package last updated on 22 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc