Documentation Index
Fetch the complete documentation index at: https://docs.dograh.com/llms.txt
Use this file to discover all available pages before exploring further.
How to add it
Add your voice agent to any website using the Configure Widget dialog in your agent’s settings. Step 1: Open the agent settings by clicking the gear icon in the top-right of the agent editor.



Embed modes
| Mode | What it renders | When to use |
|---|---|---|
| Floating Widget | A pill-shaped CTA button anchored to a corner of the page. | You want a turn-key chat-bubble experience that doesn’t disturb your existing layout. |
| Inline Component | A panel rendered inside a <div id="dograh-inline-container"> that you place in your page. | You want the agent embedded in a specific section (landing-page hero, support tab, etc.). |
| Headless | No UI. Only the audio pipeline plus a JavaScript API on window.DograhWidget. | You want full control over the UI — your own buttons, design system, framework state, animations. |
Prerequisites
These apply to all three modes:- Serve your page over HTTPS or from
http://localhost. Browsers refuse microphone access on plain HTTP origins orfile://. - If you set Allowed Domains in the dashboard, include your test origin (e.g.
localhost) — otherwise the widget’s config and signaling requests are rejected. Leave the list empty to allow all domains. - The embed snippet you copy from the dashboard is a single
<script>tag that loadsdograh-widget.jsasynchronously. The widget auto-initializes once it loads and exposeswindow.DograhWidget. Code that registers callbacks must wait for the widget to be available.
Floating Widget

Inline Component

<div> you place in your page. Status changes update the panel in place.
Configure Button Text, Button Color, and Call to Action Text from the dashboard.
Plain HTML
Place a container<div> where you want the widget to render. The widget auto-attaches to it.
React
Because React mounts after the widget script may have already loaded, integrate viainitInline on first mount and refresh on remount. Poll for window.DograhWidget to handle the async script load.
Headless Mode

JavaScript API
| Method / Callback | Description |
|---|---|
window.DograhWidget.start() | Begin a voice call. Must be called from inside a user-gesture handler (e.g. click) so the browser grants microphone access. |
window.DograhWidget.end() | End the active call. |
window.DograhWidget.onCallStart(cb) | Fires when start() is invoked (status connecting). No payload. |
window.DograhWidget.onCallConnected(cb) | Fires when the WebRTC connection is established. Payload: { agentId, workflowRunId, token }. |
window.DograhWidget.onCallDisconnected(cb) | Fires only if the call had connected, when teardown runs. Payload: { agentId, workflowRunId, token, durationSeconds }. |
window.DograhWidget.onCallEnd(cb) | Fires whenever the call session is torn down (including failed-to-connect attempts). No payload. |
window.DograhWidget.onStatusChange(cb) | Fires on every status change. Callback receives (status, text, subtext). Status values: idle, connecting, connected, failed. |
window.DograhWidget.onError(cb) | Fires on errors (mic permission denied, server error, etc.). Callback receives an Error object. |
on* setters are single-listener — calling the same one again replaces the previous handler.
About timing. The widget script loads asynchronously, so
window.DograhWidget may not exist at the moment your inline <script> first runs. The examples below assume window.DograhWidget is already available when registration runs. To guarantee that:- Vanilla JS: wrap your registration code in
window.addEventListener('load', () => { /* register here */ }). - React: inside
useEffect, register immediately ifdocument.readyState === 'complete', otherwise add a one-timewindow.loadlistener that registers on fire. - Click handlers that call
start()/end()don’t need a guard — by the time a user clicks, the widget has long since loaded.
Vanilla JS
React + TypeScript
start() must run inside a real user-gesture handler (click, touchend, etc.). Browsers refuse to grant microphone access to scripts that request it outside of one — calling start() from a setTimeout or on page load will fail with a permission error.Lifecycle callbacks (all modes)
Theon* callbacks in the Headless JavaScript API work in all three embed modes, not just Headless. Use them for analytics or to trigger UI in the host page even when the widget is rendering its own UI (Floating or Inline).
onCallConnected and onCallDisconnected only fire when the call actually establishes a media connection — failed-to-connect attempts (e.g. denied mic, network failure) don’t trigger them, so analytics stay clean.