Installation
Which packages to install for each integration style, plus peer requirements and the stylesheet.
Choose your packages
| Integration | Install |
|---|---|
| Styled drop-in | @dialogueai/react-ui + @dialogueai/react |
| Headless / custom UI | @dialogueai/react |
| Non-React page | @dialogueai/loader (or the CDN script) |
| Non-React framework, direct core | @dialogueai/web-sdk-core |
pnpm add @dialogueai/react @dialogueai/react-ui@dialogueai/react re-exports the core’s public contract (types, DialogueError, phases), so a React integrator rarely installs @dialogueai/web-sdk-core directly. The core is the framework-agnostic orchestrator (DialogueCore) for non-React hosts and tests; it has no dedicated guide yet, so start from Architecture and the Types reference if you need to drive it directly.Peer dependencies
reactandreact-dom18 — peer of@dialogueai/reactand@dialogueai/react-ui.livekit-clientis bundled and driven internally. Never import it directly. Host code reaches the connection only throughuseConnection().
Importing styles
The styled layer ships a precompiled stylesheet. Import it once, anywhere in your app (importing it more than once is harmless):
import '@dialogueai/react-ui/styles.css';By default the UI also mounts inside a Shadow DOM root and injects the same styles there, so it is isolated from your page’s CSS. You can opt out via appearance.shadowRoot; see Appearance & theming.
The CDN loader
For non-React pages, drop the hosted stub. It installs window.Dialogue, stays tiny, and lazy-loads the React tree on the first open().
<script async src="https://sdk.dialogue.ai/v1/dialogue.js"></script>
<script>
window.Dialogue = window.Dialogue || function () { (Dialogue.q = Dialogue.q || []).push(arguments) };
Dialogue('init', { publishableKey: 'pk_live_…' });
Dialogue('open', { studyId: '019e16c4-…' });
</script>SSR & Next.js
The SDK is browser-only (it touches navigator.mediaDevices, WebRTC, the DOM). In the App Router, mount it from a Client Component ('use client') so it never runs during server rendering. The packages are consumed as their built dist, so you don’t need transpilePackages.
localhost) and, inside an iframe, an explicit allow="camera; microphone; display-capture". Check support up front with usePreflight().Same-origin proxy (baseUrl)
By default the SDK calls the Dialogue REST API at its own origin (cross-origin from your page). The optional baseUrl prop points those REST calls at a path on your origin instead, which you proxy to Dialogue. Reach for it when:
- a strict
connect-srcCSP only allows same-origin requests; - ad/tracker blockers interfere with the third-party API origin; or
- you want all REST traffic to appear first-party in your logs.
// Proxy /dlg/* on your origin to the Dialogue API.
export default {
async rewrites() {
return [{ source: '/dlg/:path*', destination: 'https://api.dialogueai.com/:path*' }];
},
};<DialogueProvider baseUrl="/dlg" bootstrapTokenProvider={getToken}>
<Interview studyId={studyId} />
</DialogueProvider>baseUrl. If a CSP is the reason you need a proxy, you must still allow the LiveKit origins in connect-src/media-src or you’ll hit host.csp-blocks-livekit.