Skip to main content
Every shared agent can be embedded as an <iframe> on any website. The avatar then connects directly from your visitor’s browser to the agent — no backend required on your side.

Prerequisites

1

Enable embedding

Open the agent in the dashboard and turn on Allow embedding. Only shared agents can be embedded. Toggling this switch is saved immediately — you can test right away without saving the agent manually first.
2

Allow your origin

Under Allowed origins, add the address(es) of the page(s) that may run the avatar — for example https://www.your-domain.com.
If the embedding page’s origin is not on the list, the browser blocks the iframe (via frame-ancestors) and all messaging commands are rejected. Enter the exact origin (scheme + host + port), without a path.
3

Copy the snippet

Copy the ready-made embed code from the dashboard, or build it yourself as described below.

Quickstart

Replace AGENT_ID with your agent’s UUID (visible in the dashboard).
The allow="microphone; autoplay" attribute is required: without microphone the visitor cannot speak, and without autoplay audio playback will not start automatically in some browsers (the “Enable sound” overlay takes over instead).
Don’t want to set up your own page first? Use the built-in embedding test page at avaluma.ai/embed-test: enter an agent UUID, embed it, and try the postMessage bridge (handshake, send text, microphone on/off, event log) right away. Just add https://avaluma.ai to the agent’s Allowed origins once.

Start screen preview

Before the visitor clicks “Start conversation”, the real avatar is not yet connected — no session is established and nothing is spoken. If the agent’s avatar has a preview video configured, the start screen plays it as a silent, seamless loop (back and forth) until the visitor starts. Without a configured video, the start screen stays a solid color (see border). The preview video is configured on the avatar and automatically applies to every agent that uses that avatar — you don’t need to change your embed code. We recommend a small MP4 already exported as a boomerang (forward + reverse).

Fullscreen displays

Embedding always renders the avatar inline, inside the iframe container you place on your page. For a standalone, fullscreen display — for example an unattended kiosk stand — use the dedicated Kiosk mode instead of an iframe. It opens directly as a top-level page (no iframe) and adds a screen wake lock, an idle auto-reset, and a home-screen web app for true fullscreen.

Query parameters

All options are appended as query parameters to the /embed URL. Invalid values fall back to their defaults automatically.
string
default:"000000"
Background / letterbox color as a 6-digit hex value without # (e.g. f5f5f5).
string
default:"contain"
How the avatar preview and live stream are displayed inside the iframe. contain shows the full image (possibly with thin bars in the border color); cover fills the area and crops the edges. Applies to both the start-screen video and the running avatar.
string
default:"en"
UI language of the controls. de or en.
boolean
default:"false"
With true the text-chat input is hidden (voice/avatar-only mode).
boolean
default:"false"
With true the “Hang up” button is shown.
The microphone stays open for the duration of a conversation. If you want to mute or re-enable it from your page (e.g. your own push-to-talk button), control it via postMessage — see Messaging.

Example with multiple options

Sound & volume

Like the kiosk, the embedded agent optimizes playback automatically: on iPad/iPhone audio plays at full volume, on Android it routes to the loud system speaker. A gear icon in the top right of the iframe lets you adjust the audio processing and output device — see the kiosk Sound & volume section for details.

Messaging

Beyond simply embedding the avatar, you can control it programmatically and react to its behavior. An embedded agent runs inside an <iframe>, so your page and the avatar live in different browser contexts. They communicate through the standardized window.postMessage API: you send messages to the iframe and receive events from it. Every message carries the avaluma: prefix so that foreign messages (e.g. from third-party scripts) are safely ignored.
Messaging only works if your page’s origin is listed under the agent’s Allowed origins (see Prerequisites above). Messages from or to a disallowed origin are rejected by the browser.

Get a reference to the iframe

Give your embed an id so you can address its contentWindow:

Flow (handshake)

The bridge announces itself with a ready beacon on every (re)mount. The parent page confirms with init, registering its origin as the target for outbound events.
1

Receive ready

As soon as the bridge inside the iframe is ready, it sends { type: "avaluma:ready" }.
2

Send init back

The parent page replies with { type: "avaluma:init" }. Only then does the bridge know the target origin and can deliver events.
3

Send & receive

From now on the page can send sendMessage and receives connected, agentMessage, and disconnected.
Always respond to every ready beacon with init. After “hang up” and reconnecting, the bridge restarts and sends ready again — the repeated init keeps events flowing seamlessly.

Send messages to the avatar

Send a message to the iframe’s contentWindow. Always pass the Avaluma origin as the second argument so the message is only delivered to the avatar:
A conversation is started by the visitor via “Start conversation” inside the iframe. avaluma:sendMessage only takes effect while a conversation is active.

Receive events from the avatar

Listen for message events on window. Always check event.origin before trusting the data:
Typed chat messages are immediately final: true. Streamed speech transcripts are considered complete once the text stops changing for about 1 second — then exactly one closing final: true event with the full text follows. Multiple events with the same id belong to the same message; use the id to update the display instead of appending. If you only need the final result, filter for final === true.

Full test example

The quickest way without writing your own code: the built-in embedding test page at avaluma.ai/embed-test. It embeds an agent from the avaluma.ai domain and visualizes the full bridge (handshake, send text, microphone on/off, event log). Just add https://avaluma.ai to the agent’s Allowed origins.
A standalone HTML page that embeds the avatar, sends text to it, and shows all events in a small log. Serve it locally with a static server (e.g. python3 -m http.server 8080) and add its origin (http://localhost:8080) to the agent’s Allowed origins.
Replace AGENT_ID with your agent’s UUID. For sending to work, the test page’s origin must be listed under the agent’s Allowed origins.

Security checklist

1

Always specify the target origin

Never use "*" as the target origin in postMessage. Pass https://avaluma.ai so messages can’t reach other frames.
2

Always verify the source origin

In your message listener, reject every event whose event.origin is not https://avaluma.ai.
3

Keep allowed origins tight

Under Allowed origins in the Dashboard, list only the origins that actually host the avatar.