Overview
Every AgentHuman link can be embedded directly into your web page as an<iframe>. The embedded page communicates bidirectionally with the parent via the postMessage API, so you can control it and react to call events from your own code.
Embedding the Page
Get your link URL from app.agenthuman.com/links and use it as thesrc:
Customization via Query Parameters
All query parameters available for the direct link — language, theme colors and auto-hide behavior — work identically when embedding as an iframe. Append them to thesrc URL:
Controlling the Page (Commands)
Send commands from your parent page into the iframe usingpostMessage. The easiest way is with the createRoomClient helper.
Using createRoomClient
Raw postMessage Commands
If you prefer not to use the helper, send messages directly:
| Command type | Payload | Description |
|---|---|---|
room:set_mute | { muted: boolean } | Mute or unmute the microphone |
room:set_speaker | { muted: boolean } | Mute or unmute the speaker |
room:end_call | — | End the call |
room:show_controls | { visible: boolean } | Show or hide the control bar |
room:set_fullscreen | { enter: boolean } | Enter or exit fullscreen |
room:set_auto_hide | { enabled: boolean } | Enable or disable the auto-hide timer |
Listening to Events
The page firespostMessage events to the parent window as the call state changes. Listen for them with a message event handler:
| Event type | Payload fields | Description |
|---|---|---|
room:connecting | — | Establishing connection |
room:connected | — | Connected and ready |
room:reconnecting | — | Lost connection, retrying |
room:ended | duration: number | Call ended; duration is call length in seconds |
room:mute_changed | muted: boolean | Microphone mute state changed |
room:speaker_changed | muted: boolean | Speaker mute state changed |
room:mic_permission | permission: "granted" | "denied" | "prompt" | Browser microphone permission status |
room:mic_device_changed | deviceId: string, deviceLabel: string | Active microphone device changed |
room:fullscreen_changed | isFullscreen: boolean | Fullscreen state changed |
source: "agenthuman-room" field and a timestamp (Unix ms).