import { Room } from '@altanlabs/sdk';
<Room
mode="agent"
accountId="account-id"
agentId="agent-123"
guestInfo={{ first_name: "John", external_id: "user-123" }}
/><Room
mode="compact"
....
/>| Prop | Type | Required | Description |
|---|---|---|---|
mode | "agent" | ✅ | Chat with agent or join room |
accountId | string | ✅ | Your Altan account ID |
agentId | string | ✅ | Agent ID (required for agent mode) |
guestInfo | object | ❌ | User info (name, external_id, email) |
guestInfo:external_id (string): user’s ID in your Supabase users table (enables history).first_name, last_name, email (strings): user’s personal info.MUST RULE: All IDs and user data must be loaded dynamically from your database. Do NOT hard‑code any values.
get_project action.users table’s primary key for the current user.guestInfo. You must follow these rules exactly when populating it:external_id is the primary key for user history.guestInfo.external_id only if it matches an existing user ID in your users table.null.first_name, last_name, email, or external_id (except null).external_id dynamically (e.g., guest_${Date.now()}) or make up any user fields.null.guestInfo values directly from the canonical user store (users table).null.guestInfo.external_id is valid and consistent.external_id into the SDK, verify it exists in the users table. If the required users table is missing, trigger your orchestration logic to create it. Do not proceed assuming history will work without that validation.const user = await fetchCurrentUserFromDB(); // must come from your users table
<Room
mode="agent"
accountId={resolveAccountId()} // loaded dynamically
agentId={resolveAgentId()} // loaded dynamically
guestInfo={{
first_name: user?.first_name || null,
last_name: user?.last_name || null,
email: user?.email || null,
external_id: user?.id || null, // MUST be an existing user ID
}}
/>guestInfo={{
first_name: "Guest", // ❌ hardcoded
external_id: `guest_${Date.now()}`, // ❌ invented
email: "someone@example.com", // ❌ hardcoded
last_name: "User" // ❌ hardcoded
}}guestInfo={{
external_id: "nonexistent-id", // ❌ not verified against users table
}}| Property | Type | Default | Description |
|---|---|---|---|
tabs | boolean | true | Show/hide tab navigation |
conversation_history | boolean | true | Show/hide conversation history |
members | boolean | true | Show/hide members panel |
settings | boolean | true | Show/hide settings panel |
theme | string | undefined | Theme mode: 'light', 'dark', or 'system' |
title | string | undefined | Custom title |
description | string | undefined | Custom description |
voice_enabled | boolean | true | Enable/disable voice functionality |
suggestions | string[] | [] | Predefined message suggestions |
| Property | Type | Default | Description |
|---|---|---|---|
primary_color | string | #007bff | Primary color (hex) for buttons and accents |
background_color | string | #ffffff | Background color (hex) for the widget |
background_blur | boolean | true | Enable glassmorphism background blur effect |
position | string | bottom-center | Position: 'bottom-right', 'bottom-left', 'bottom-center' |
widget_width | number | 350 | Widget width in pixels |
room_width | number | 450 | Room width in pixels when expanded |
room_height | number | 600 | Room height in pixels when expanded |
border_radius | number | 16 | Border radius in pixels for rounded corners |
import React from 'react';
import { Room } from '@altanlabs/sdk';
function App() {
return (
<div style={{ height: '600px' }}>
<Room
mode="agent"
accountId="altan-account-id"
agentId="agent-123"
guestInfo={{
first_name: 'Jane',
last_name: 'Doe',
email: 'jane@example.com',
external_id: 'user-456'
}}
onConversationReady={(room) => console.log('Chat ready!')}
onAuthSuccess={(guest) => console.log('User authenticated:', guest.id)}
/>
</div>
);
}