How to Embed Omni AI Chat using the SDK
If you are looking to embed the Omni AI Chat experience directly into your application, you can do so using the embedSsoContentDiscovery function provided by the @omni-co/embed SDK.
Unlike standard dashboard embedding, the AI Chat requires targeting a specific path and configuring a few additional parameters to ensure the interface renders correctly without the full navigation wrapper.
Implementation
Here is a streamlined example of how to generate the signed URL for the AI Chat in a NodeJS backend environment (e.g., a Next.js API route).
Prerequisites
Ensure you have the SDK installed:
npm install @omni-co/embed
Server-Side Code
import { embedSsoContentDiscovery } from '@omni-co/embed';
// ... inside your API handler
const embedUrl = await embedSsoContentDiscovery({
// CRITICAL: Point to the chat interface
path: "/chat",
// Standard SSO configuration
secret: OMNI_EMBED_SECRET, // Your embedding secret
host: "``your-org.embed-omniapp.co``",// Your Omni instance host
externalId: "user_123",// Unique ID for the user in your system
name: "John Doe",// Display name
// Restrict data access via Connection Roles
connectionRoles: {
"your-connection-uuid": "RESTRICTED_QUERIER"
},
// Recommended Settings for Chat
// 'blank'theme removes the sidebar/chrome for a clean embed
theme: 'blank',
// Ensures links/drill-downs behave correctly within the iframe
linkAccess: '__omni_link_access_open',
});
// Return this URL to your frontend to set as the iframe 'src'
return { url: embedUrl };
Key Configuration Details
-
path: “/chat”: This is the most important parameter. It tells Omni to load the conversational AI interface instead of the standard content discovery home page.
-
theme: ‘blank’: We recommend using the ‘blank’ theme to strip away the default Omni navigation bar, giving the chat a native feel within your application.
-
linkAccess: Setting this ensures that if the AI generates charts or links, the user has the appropriate permissions context to view them.