npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

doctalkie-react

v0.1.6

Published

React component for DocTalkie AI chat widget

Readme

DocTalkie - AI Assistant Integration Service

Welcome to the official documentation for DocTalkie. Here you will find everything you need to embed the chat widget or build your own chat interface using our tools.

DocTalkie allows you to create AI assistants based on your documents. This documentation covers how to integrate the chat experience into your application.

Explore the sections below: 'Usage: Chat Widget' for the quickest integration, or 'Usage: Hook' for building a custom interface.


Installation

To integrate DocTalkie into your React project, install the package using your preferred package manager:

Using npm:

npm install doctalkie-react

Using yarn:

yarn add doctalkie-react

Using pnpm:

pnpm add doctalkie-react

Once installed, you can import the necessary components or hooks into your application as shown in the usage sections.


Usage: Chat Widget (Minimal)

The easiest way to add a DocTalkie chat to your application is by using the built-in DocTalkieChat component. It provides a ready-to-use floating chat interface. Below is the minimal setup required.

Minimal Example:

import DocTalkieChat from "@/components/doc-talkie-chat/doc-talkie-chat";

export default function MyApp() {
  // Get these values from your DocTalkie dashboard for the specific bot
  const botApiUrl = "YOUR_BOT_API_URL"; // Replace with your Bot's API URL
  const botApiKey = "YOUR_BOT_API_KEY"; // Replace with your Bot's API Key

  return (
    <div>
      <h1>My Application</h1>
      {/* Minimal chat widget setup */}
      <DocTalkieChat apiURL={botApiUrl} apiKey={botApiKey} />
    </div>
  );
}

Replace YOUR_BOT_API_URL and YOUR_BOT_API_KEY with the actual URL and key provided for your bot in the DocTalkie dashboard.


Widget Configuration & Customization

The DocTalkieChat component accepts required and optional props for customization:

Required Props

| Prop | Description | Type | | :------- | :-------------------------------------------------------------- | :------- | | apiURL | The full API URL for your bot, obtained from the dashboard. | string | | apiKey | The specific API key for your bot, obtained from the dashboard. | string |

Optional Props

| Prop | Description | Type | Default | | :--------------- | :--------------------------------------------------------------------------------------------- | :------- | :------------------------------------ | | theme | Visual theme ("light", "dark", or "doctalkie"). | string | "doctalkie" | | accentColor | Background color for user messages (e.g., "#FF5733"). Overrides theme color for user messages. | string | Theme default | | position | Widget position ("bottom-right" or "bottom-left"). | string | "bottom-right" | | welcomeMessage | Custom initial message from the assistant. | string | "Hi there! How can I help you today?" | | className | Additional CSS classes for the root widget container. | string | None |

Example with Customizations

Demonstrating various optional props.

import DocTalkieChat from "@/components/doc-talkie-chat/doc-talkie-chat";
// import './my-custom-styles.css'; // If using className

export default function AnotherPage() {
  const botApiUrl = "YOUR_BOT_API_URL"; // Replace with your Bot's API URL
  const botApiKey = "YOUR_BOT_API_KEY"; // Replace with your Bot's API Key

  return (
    <div className="app">
      <header>
        <h1>Another Page with Customized Chat</h1>
      </header>
      {/* --- Customized DocTalkie Chat Widget --- */}
      <DocTalkieChat
        apiURL={botApiUrl}
        apiKey={botApiKey}
        // Customizations:
        theme="light"
        position="bottom-left"
        accentColor="#8B5CF6" // Example: Violet color for user messages
        welcomeMessage="Ask me anything about the advanced topics!"
        className="my-custom-widget-styles" // Optional custom class for further styling
      />
      {/* --------------------------------------- */}
    </div>
  );
}

Usage: Hook (Advanced)

For complete control over the chat UI, you can use the useDocTalkie hook. It handles the API communication and state management, allowing you to build a custom interface.

Example:

import { useState, useEffect } from "react";
import {
  useDocTalkie,
  type Message,
} from "@/components/doc-talkie-chat/use-doc-talkie";

function MyCustomChatInterface() {
  const botApiUrl = "YOUR_BOT_API_URL"; // Replace with your Bot's API URL
  const botApiKey = "YOUR_BOT_API_KEY"; // Replace with your Bot's API Key
  const [input, setInput] = useState("");

  const { messages, isLoading, error, sendMessage } = useDocTalkie({
    apiURL: botApiUrl, // Use the full URL directly
    apiKey: botApiKey,
    // Optional: Provide initial messages if needed
    // initialMessages: [{ id: 'custom-start', content: 'Start here!', sender: 'system' }]
  });

  const handleSend = () => {
    if (input.trim()) {
      sendMessage(input);
      setInput("");
    }
  };

  return (
    <div className="my-chat-container">
      <div className="messages-area">
        {error && <div className="error-message">{error}</div>}
        {messages.map((msg: Message) => (
          <div key={msg.id} className={`message ${msg.sender}`}>
            {/* Render your message bubble here using msg.content */}
            {/* You might want to use react-markdown here too! */}
            <p>{msg.content}</p>
          </div>
        ))}
        {isLoading && (
          <div className="loading-indicator">Assistant is typing...</div>
        )}
      </div>
      <div className="input-area">
        <input
          type="text"
          value={input}
          onChange={(e) => setInput(e.target.value)}
          placeholder="Ask something..."
          disabled={isLoading}
        />
        <button onClick={handleSend} disabled={isLoading || !input.trim()}>
          Send
        </button>
      </div>
    </div>
  );
}

The hook returns an object containing:

  • messages: An array of message objects.
  • isLoading: Boolean indicating if a response is pending.
  • error: String containing an error message, if any.
  • sendMessage: Function to send a new user message (takes the message string as input).

Remember to replace the placeholder IDs and keys, and style the elements (.my-chat-container, .message, etc.) according to your design.


Manage your bots and API keys via the DocTalkie Dashboard.