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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@botpress/webchat

v4.1.0

Published

A fully customizable React library that lets you seamlessly integrate Botpress Webchat into your React applications.

Readme

@botpress/webchat

A fully customizable React library that lets you seamlessly integrate Botpress Webchat into your React applications.

Features

  • 🎨 Fully Customizable - Style and configure every aspect of the webchat experience
  • 🔌 Easy Integration - Simple installation and setup process
  • 🛠️ Flexible Architecture - Use pre-built components or build custom implementations
  • 📱 Responsive - Works seamlessly across desktop and mobile devices

Installation

# npm
npm install @botpress/webchat

# yarn
yarn add @botpress/webchat

# pnpm
pnpm install @botpress/webchat

Requirements

  • React 18 or higher
  • A published Botpress bot
  • Your bot's Client ID

Quick Start

Get Your Client ID

  1. Open your bot in the Botpress Dashboard
  2. Navigate to Webchat in the left sidebar
  3. Open the Features sub menu
  4. Go to the Advanced Settings tab
  5. Copy your Client ID

Basic Implementation

import { Fab, Webchat } from '@botpress/webchat'
import { useState } from 'react'

function App() {
  const [isWebchatOpen, setIsWebchatOpen] = useState(false)

  return (
    <>
      <Webchat
        clientId="YOUR_CLIENT_ID"
        style={{
          width: '400px',
          height: '600px',
          display: isWebchatOpen ? 'flex' : 'none',
          position: 'fixed',
          bottom: '90px',
          right: '20px',
        }}
      />
      <Fab
        onClick={() => setIsWebchatOpen(!isWebchatOpen)}
        style={{
          position: 'fixed',
          bottom: '20px',
          right: '20px',
          width: '64px',
          height: '64px',
        }}
      />
    </>
  )
}

Advanced Usage

Custom Webchat Implementation

For more control over the webchat experience, build it manually using individual components:

import { Container, Header, MessageList, Composer, useWebchat, Fab } from '@botpress/webchat'
import { useState, useMemo } from 'react'

function App() {
  const [isWebchatOpen, setIsWebchatOpen] = useState(false)
  const { client, messages, isTyping, user, clientState, newConversation } = useWebchat({
    clientId: 'YOUR_CLIENT_ID',
  })

  const config = {
    botName: 'SupportBot',
    botAvatar: 'https://example.com/avatar.png',
    botDescription: 'Your virtual assistant',
  }

  const enrichedMessages = useMemo(
    () =>
      messages.map((message) => {
        const direction = message.authorId === user?.userId ? 'outgoing' : 'incoming'
        return {
          ...message,
          direction,
          sender:
            direction === 'outgoing'
              ? { name: user?.name ?? 'You', avatar: user?.pictureUrl }
              : { name: config.botName, avatar: config.botAvatar },
        }
      }),
    [messages, user, config]
  )

  return (
    <>
      <Container
        connected={clientState !== 'disconnected'}
        style={{
          width: '500px',
          height: '800px',
          display: isWebchatOpen ? 'flex' : 'none',
          position: 'fixed',
          bottom: '90px',
          right: '20px',
        }}
      >
        <Header
          closeWindow={() => setIsWebchatOpen(false)}
          restartConversation={newConversation}
          configuration={{
            botName: config.botName,
            botAvatar: config.botAvatar,
            botDescription: config.botDescription,
          }}
        />
        <MessageList
          botName={config.botName}
          botDescription={config.botDescription}
          isTyping={isTyping}
          messages={enrichedMessages}
          sendMessage={client?.sendMessage}
        />
        <Composer
          connected={clientState !== 'disconnected'}
          sendMessage={client?.sendMessage}
          uploadFile={client?.uploadFile}
          composerPlaceholder="Type a message..."
        />
      </Container>
      <Fab
        onClick={() => setIsWebchatOpen(!isWebchatOpen)}
        style={{
          position: 'fixed',
          bottom: '20px',
          right: '20px',
        }}
      />
    </>
  )
}

Configuration

Using the Webchat Component

Pass configuration through the configuration prop:

<Webchat
  clientId="YOUR_CLIENT_ID"
  configuration={{
    botName: 'My Bot',
    botAvatar: 'https://example.com/avatar.png',
    botDescription: 'Here to help!',
  }}
/>

Custom Styling

Use the StylesheetProvider component for custom themes:

import { StylesheetProvider } from '@botpress/webchat'
;<StylesheetProvider />
{
  /* Your webchat components */
}

Components

  • Webchat - All-in-one webchat component
  • Container - Webchat container wrapper
  • Header - Customizable header with bot info
  • MessageList - Message display area
  • Composer - Message input and file upload
  • Fab - Floating action button
  • StylesheetProvider - Custom styling provider
  • useWebchat - Hook for webchat state and methods

Documentation

For detailed documentation, examples, and API reference, visit:

Botpress Webchat React Library Documentation

Support

License

This library is part of the Botpress ecosystem. See the Botpress repository for license information.