> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ampup.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat Widget

> Add an AI-powered voice and text chat widget to your website

The AmpUp Chat Widget is a drop-in React component that adds AI-powered voice and text chat to any website. It connects to [ElevenLabs Conversational AI](https://elevenlabs.io) agents and provides a branded chat interface with both voice calling and text messaging.

## Prerequisites

> [!TIP]
>
> React 18 or higher

> [!TIP]
>
> An [ElevenLabs](https://elevenlabs.io) Conversational AI agent ID

## Installation

Install the package from npm:

```bash theme={null}
npm install @ampup/chat-widget
```

> [!NOTE]
>
> The widget requires `react` and `react-dom` as peer dependencies. If your project doesn't already have them:
>
> ```bash theme={null}
> npm install react react-dom
> ```

## Quick Start

Import the component and render it anywhere in your app:

```tsx theme={null}
import { ChatWidget } from "@ampup/chat-widget";

function App() {
  return <ChatWidget agentId="your_elevenlabs_agent_id" />;
}
```

A floating chat button appears in the bottom-right corner. Users can click it to open the widget and choose between **voice call** or **text chat** to interact with your AI agent.

## How It Works

1. The `<ChatWidget>` uses the `useConversation` hook from `@elevenlabs/react` to manage two separate sessions — one for voice calls and one for text chat.
2. A **WebSocket proxy** intercepts the ElevenLabs connection to read transcripts and inject context updates in real time.
3. The widget renders a complete chat UI — floating action button, agent card with avatar, voice call controls with timer, and a full text chat interface — all as inline React components.

## Features

> [card] Voice Calls
>
> One-click voice calls with real-time audio visualization, call timer, and automatic transcript capture.

> [card] Text Chat
>
> Full text chat with message bubbles, typing input, and real-time agent responses.

> [card] SPA Navigation
>
> Built-in `navigateToPage` and `scrollToSection` client tools let the agent navigate users around your app.

> [card] Dynamic Context
>
> Pass dynamic variables to your agent so it has context about the current user, page, or application state.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.