Getting Started with Embedding
1. Enable Embedding
To enable the embedding feature:- You must have admin privileges in your Cube instance.
- Navigate to Admin → API → Embed.
- Click Enable Embedding.
2. Get Your API Key
To use the embedded chat, you need an API Key:- Navigate to Users → API Keys in your Cube admin panel.
- Generate or copy your existing API key.
- You’ll use this key to authenticate API calls for generating embed sessions.
3. Generate an Embed Session
Use the/api/v1/embed/generate-session
endpoint to create a session for your user. This endpoint will automatically create (insert) or update the external user based on the externalId
provided.
Accounts are limited to 10,000 external users. To increase this limit, please contact support.
Example (JavaScript)
4. Embedding via iframe
Use the session ID to embed the chat UI in your application:User Attributes
User attributes enable row-level security and personalized chat responses by filtering data based on user permissions. The attributes you pass during session generation automatically filter data queries and responses.User attributes must first be configured in your Cube D3 admin panel. See the User Attributes Administration Guide for setup instructions.
- Configure attributes in your admin panel (e.g.,
city
,department
) - Pass attributes during session generation
- Data is automatically filtered based on user permissions through access policies
- AI responses are personalized to the user’s context
- Sales reps only see data for their assigned territory
- Regional managers see data filtered by their city
- Department heads see only their department’s metrics