Embed a Voice Widget on Your Website
The Truedy embed widget lets anyone add a live AI voice call button to their website with a single<script> tag. Visitors click the button and speak directly to your Truedy AI agent in real time — no phone number, no app download, no backend required.
This guide covers the pre-built Truedy widget — the fastest way to go live. If you need full control over the UI and want to build a completely custom widget from scratch, see the Custom Voice Widget guide instead.
How it works
Step 1 — Create a widget in the dashboard
- Go to app.truedy.ai → Widgets in the sidebar
- Click Create Widget
- Configure your widget:
- Agent — which AI agent answers calls from this widget
- Display name & subtext — shown to visitors
- Primary colour — matches your brand
- Avatar — upload a profile image (displayed when the agent is idle)
- Speaking avatar — optional image shown when the agent is talking
- Widget style — Bubble (floating FAB), Pill, or Side Tab
- Position — bottom-right or bottom-left
- Placement mode — Overlay (floating) or Embedded (inline in your page)
- Allowed domains — restrict which websites can use this widget (recommended)
- Click Save
Step 2 — Copy the embed code
After saving, the widget builder shows your embed snippet in the Embed Code panel. Copy it — it looks like this: Overlay mode (floating button):Step 3 — Paste it on your website
Paste the embed snippet just before the closing</body> tag on any page where you want the widget to appear.
HTML site:
next/script or a useEffect to load the script:
Configuration reference
All options passed toTruedyWidget.init():
Identity
| Option | Type | Default | Description |
|---|---|---|---|
widgetId | string | — | Recommended. Your widget’s UUID from the dashboard. Loads all saved settings automatically. |
agentId | string | — | Your agent’s UUID. Required alongside widgetId. |
Display
| Option | Type | Default | Description |
|---|---|---|---|
agentName | string | "AI Assistant" | Name shown in the widget header |
agentSubtext | string | "Live AI Voice Assistant" | Subtitle shown below the name |
primaryColor | string | "#6366f1" | Brand colour (6-digit hex, e.g. #FF5733) |
buttonText | string | "Talk to AI" | Label on the trigger button |
profilePictureUrl | string | — | Avatar image URL (shown when idle) |
speakingPictureUrl | string | — | Avatar image URL shown when agent is speaking |
fontFamily | string | "Inter, sans-serif" | CSS font-family for the widget UI |
darkMode | boolean | false | Enable dark theme |
Layout & Position
| Option | Type | Default | Description |
|---|---|---|---|
position | "bottom-right" | "bottom-left" | "bottom-right" | Corner for the floating widget |
size | "small" | "medium" | "large" | "medium" | Size of the trigger button |
placementMode | "overlay" | "embedded" | "overlay" | Floating overlay or inline in your layout |
embeddedJustification | "left" | "center" | "right" | "center" | Alignment when placementMode is "embedded" |
Behaviour
| Option | Type | Default | Description |
|---|---|---|---|
showPostCallRecap | boolean | false | Show a transcript summary after the call ends |
speakingAnimation | boolean | true | Animate the avatar with a pulse when the agent speaks |
autoOpen | boolean | false | Automatically open the widget panel on page load |
allowedDomains | string[] | — | Restrict the widget to specific domains (e.g. ["mysite.com", "*.mysite.com"]) |
Domain restrictions (recommended)
Lock your widget to your own domains so it cannot be used on other sites. Set allowed domains either in the dashboard UI or in theallowedDomains config option:
*.mysite.com) match all subdomains. The check runs both client-side (blocks render) and server-side (blocks call creation), so it cannot be bypassed.
Embedded mode
To place the widget inline inside your page layout rather than as a floating overlay, useplacementMode: "embedded" and add a <div> target:
div, inheriting its width. Use CSS to control size and positioning.
Programmatic control
You can trigger the widget from your own buttons or application logic:React / SPA lifecycle cleanup
When using the widget in a single-page app, calldestroy() to clean up when the component unmounts:
Post-call transcript
EnableshowPostCallRecap: true to automatically show the visitor a summary of the conversation after the call ends. This is useful for support or sales contexts where the visitor wants a record.
call.ended event with the full transcript when each call finishes.
Troubleshooting
Widget doesn’t appear- Check browser console for errors
- Ensure the script URL is correct:
https://api.truedy.ai/widget.js - Confirm
widgetIdandagentIdare valid UUIDs
- Your current domain is not in the widget’s
allowedDomainslist - Add your domain in the dashboard under Widgets → Edit → Allowed Domains, or remove the restriction entirely during development
- The page must be served over HTTPS (or localhost) — browsers block mic access on plain HTTP
- The visitor must grant microphone permission when prompted
- Verify your agent is set to Active in the dashboard
- Check that the agent has been saved and synced (a spinner may appear briefly after creation)
- Ensure the visitor hasn’t muted the browser tab
- Some corporate networks block WebRTC — this is outside Truedy’s control
Next steps
- Webhooks — receive call events and transcripts on your server
- Creating an Agent — configure your AI agent’s voice, personality, and tools
- Custom Voice Widget — build a fully custom widget UI with the Ultravox SDK
- WebRTC API Reference — low-level API docs for programmatic call creation

