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

@sendbird/ai-agent-messenger-react

v1.20.1

Published

Delight AI Agent Messenger for React

Readme

React (npm)

The Delight AI agent Messenger React allows seamless integration of chatbot features into your React application.

This guide explains:


Prerequisites

Before you start, you'll need your Application ID and AI agent ID.

You can find it under the Channels > Messenger menu on the Delight AI dashboard.

ai-agent-app-id-agent-id

System requirements:

  • React >=18.0.0
  • React DOM >=18.0.0
  • @sendbird/chat ^4.19.0
  • styled-components >=5.0.0

Getting started

Quickly install and initialize the AI agent SDK by following the steps below.

Step 1. Install AI agent SDK

Install the package with its peer dependencies using npm or yarn:

npm install @sendbird/ai-agent-messenger-react @sendbird/chat styled-components
# or
yarn add @sendbird/ai-agent-messenger-react @sendbird/chat styled-components

Note: Modern npm versions automatically install peer dependencies, but explicitly installing them ensures compatibility and avoids potential version conflicts.

Step 2. Initialize AI agent SDK

The React SDK provides two main approaches for integration:

Option 1: FixedMessenger (recommended for quick setup)

FixedMessenger provides a predefined UI toolkit with launcher and messenger at fixed position (bottom-right):

import { FixedMessenger } from '@sendbird/ai-agent-messenger-react';
import '@sendbird/ai-agent-messenger-react/index.css';

function App() {
  return <FixedMessenger appId="YOUR_APP_ID" aiAgentId="YOUR_AI_AGENT_ID" />;
}

Option 2: AgentProviderContainer (for custom UI implementations)

AgentProviderContainer allows for custom UI implementations and component-level integration:

import { AgentProviderContainer, Conversation } from '@sendbird/ai-agent-messenger-react';
import '@sendbird/ai-agent-messenger-react/index.css';

function App() {
  return (
    <AgentProviderContainer appId="YOUR_APP_ID" aiAgentId="YOUR_AI_AGENT_ID">
      <Conversation />
    </AgentProviderContainer>
  );
}

Custom host configuration

If needed, you can specify custom API and WebSocket hosts:

<FixedMessenger
  appId="YOUR_APP_ID"
  aiAgentId="YOUR_AI_AGENT_ID"
  customApiHost="https://your-proxy-api.example.com"
  customWebSocketHost="wss://your-proxy-websocket.example.com"
/>

Similarly, when using AgentProviderContainer:

<AgentProviderContainer
  appId="YOUR_APP_ID"
  aiAgentId="YOUR_AI_AGENT_ID"
  customApiHost="https://your-proxy-api.example.com"
  customWebSocketHost="wss://your-proxy-websocket.example.com"
>
  <Conversation />
</AgentProviderContainer>

Both properties are optional and only need to be configured if required.


Component overview

FixedMessenger vs AgentProviderContainer

FixedMessenger:

  • Complete UI toolkit with launcher and messenger
  • Fixed position (bottom-right corner)
  • Includes all necessary providers internally
  • Recommended for most use cases
  • Use standalone without additional providers

AgentProviderContainer:

  • Provider component for custom UI implementations
  • Allows building custom messenger interfaces
  • Use when you need specific UI layouts or custom components
  • Must be combined with conversation components like <Conversation />

Running your application

Now that you have installed and initialized the AI agent SDK, follow the steps below to run your application.

To launch and display the messenger, implement the code below:

Note: Replace YOUR_APP_ID and YOUR_AI_AGENT_ID with your Application ID and AI agent ID which you can obtain from the Delight AI dashboard. To learn how to do so, refer to the prerequisites section.

function App() {
  return <FixedMessenger appId="YOUR_APP_ID" aiAgentId="YOUR_AI_AGENT_ID" />;
}

FixedMessenger styles

When using the fixed messenger, FixedMssenger.Style allows you to customize its appearance and positioning:

  • margin: Defines the margin around the fixed messenger and its launcher.
  • launcherSize: Defines the size of the launcher button in pixels (width and height are equal).
  • position: Determines which corner of the screen the launcher will appear in. Available options are: start-top, start-bottom, end-top and end-bottom.
function App() {
  return (
    <FixedMessenger>
      <FixedMessenger.Style
        position={'start-bottom'}
        launcherSize={32}
        margin={{ start: 0, end: 0, bottom: 0, top: 0 }}
      />
    </FixedMessenger>
  );
}

Manage user sessions

The SDK supports two types of user sessions: Manual session for authenticated users and Anonymous session for temporary users.

Session types

1. Manual session (ManualSessionInfo): Use this when you have an authenticated user with a specific user ID and session token.

import { ManualSessionInfo } from '@sendbird/ai-agent-messenger-react';

<FixedMessenger
  appId="YOUR_APP_ID"
  aiAgentId="YOUR_AI_AGENT_ID"
  userSessionInfo={new ManualSessionInfo({
    userId: 'user_id',
    authToken: 'auth_token',
    sessionHandler: {
      onSessionTokenRequired: async (resolve, reject) => {
        try {
          const response = await fetch('new-token-endpoint');
          resolve(response.token);
        } catch (error) {
          reject(error);
        }
      },
      onSessionClosed: () => { },
      onSessionError: (error) => { },
      onSessionRefreshed: () => { }
    }
  })}
/>

2. Anonymous session (AnonymousSessionInfo): Use this when you don't have user authentication or want to allow guest access. The server will automatically create a temporary user.

import { AnonymousSessionInfo } from '@sendbird/ai-agent-messenger-react';

<FixedMessenger
  appId="YOUR_APP_ID"
  aiAgentId="YOUR_AI_AGENT_ID"
  userSessionInfo={new AnonymousSessionInfo()}
/>

The messenger view can be programmatically controlled using the state prop:

function App() {
  const [opened, setOpened] = useState(true);

  return <FixedMessenger appId="YOUR_APP_ID" aiAgentId="YOUR_AI_AGENT_ID" state={{ opened, setOpened }} />;
}

Advanced features

The following are available advanced features.

Display messenger without launcher button

Build custom messenger UI using AgentProviderContainer:

import { AgentProviderContainer, Conversation } from '@sendbird/ai-agent-messenger-react';

function App() {
  return (
    <div style={{ height: '400px', border: '1px solid #ccc' }}>
      <AgentProviderContainer appId="YOUR_APP_ID" aiAgentId="YOUR_AI_AGENT_ID">
        <Conversation />
      </AgentProviderContainer>
    </div>
  );
}

Passing context object to agent

You can predefine customer-specific information such as country, language, or other custom context data to guide the AI agent in providing faster and more accurate responses.

This allows for a more personalized and context-aware interaction experience.

Important: These settings can only be configured during initialization.

<FixedMessenger
  appId="YOUR_APP_ID"
  aiAgentId="YOUR_AI_AGENT_ID"
  // Language setting (IETF BCP 47 format)
  // default: navigator.language
  language="en-US"
  // Country code setting (ISO 3166 format)
  countryCode="US"
  // Context object for the AI agent
  context={{
    userPreference: 'technical',
    customerTier: 'premium',
  }}
/>

Localization and language support

The SDK supports multiple languages and allows you to customize UI strings. You can:

  • Set the language during initialization
  • Customize specific strings in supported languages
  • Add support for additional languages
  • Dynamically load language files

For detailed information about localization options and full list of available string sets, refer to our Localization Guide.