@robylon/robylon-web-react-sdk
Version:
React SDK for Robylon AI Chatbot
68 lines (49 loc) • 1.39 kB
Markdown
# Robylon Chatbot SDK
A React SDK for easily integrating Robylon's AI-powered chatbot into your web applications.
## Installation
```bash
npm install @robylon/chatbot-react-sdk
# or
yarn add @robylon/chatbot-react-sdk
```
## Quick Start
```jsx
import { RobylonChatbot } from '@robylon/chatbot-react-sdk';
function App() {
return (
);
}
```
## Configuration
### Required Props
- `chatbotId`: Your Robylon chatbot ID
- `userId`: Unique identifier for the current user
- `userProfile`: Object containing user information
- `email`: User's email address
- `name`: User's name
### Optional Props
- `token`: Authentication token
- `styles`: Customize the appearance
- `buttonPosition`: 'bottom-right' | 'bottom-left'
- `primaryColor`: Custom theme color
- `buttonSize`: 'small' | 'medium' | 'large'
- `loadingComponent`: Custom loading component
- `errorComponent`: Custom error component
## Advanced Usage
### Using the Hook
```jsx
import { useChatbot } from '@robylon/chatbot-react-sdk';
function CustomChatbot() {
const { isLoading, error, isInitialized } = useChatbot({
chatbotId: 'your-chatbot-id',
userId: 'user-id',
userProfile: {
email: 'user@example.com',
name: 'John Doe'
}
});
if (isLoading) return Loading...;
if (error) return Error: {error};
return null; // Chatbot UI is handled by the embedded script
}
```