Whitelabel Embedding
Whitelabel Embedding lets SaaS platforms, CRMs, and agencies embed the WhatsBox Shared Inbox and messaging interface directly inside their own web app via an <iframe>, using their workspace's business branding and programmatic authentication.
Whitelabel Embedding Example Repository
Clone our working reference implementation showing iframe setup, custom token login, and postMessage control on GitHub.
How Embedded Mode Activates
WhatsBox automatically enters Embedded Mode when loaded inside an <iframe> or accessed at /embedded or /embedded-login.
When Embedded Mode is active:
- Whitelabel Branding: The WhatsBox logo and app title are replaced by your workspace's Business Name.
- Focused Navigation: Workspace-admin and non-embedded areas—Automations, Team Members, Switch Org, API Keys, Webhooks, Integrations, Billing, Feedback/Bug Reporting, Sign Out, PWA Install Banner, and OneSignal Push—are automatically hidden or disabled.
URL Query Parameters
Load https://app.whatsbox.io/embedded inside your <iframe> with any combination of these query parameters:
| Parameter | Values | Purpose |
|---|---|---|
token | Firebase custom token | Authenticates the user immediately on load (signInWithCustomToken). |
theme | light, dark, system | Sets the initial UI theme. |
thread_id | Thread ID string | Deep-links directly to /inbox/<thread_id>. |
route | App path (e.g., /compose) | Sets the initial destination route (defaults to /inbox). |
hide_sidebar (or hide_nav / sidebar) | true / 1 or false / 0 | Hides both the desktop navigation rail and mobile bottom bar. |
hide_header | true / 1 | Hides the embedded header chrome where supported. |
postMessage JavaScript API
Events Sent by WhatsBox to Your Parent Window
{ type: "EMBED_READY" }— Emitted once the iframe initializes and is ready to receive commands.{ action: "login", status: "required", message: "User not logged in." }— Emitted on/embedded-loginwhen no valid session or?token=is present.{ action: "login", status: "init" | "success" | "error" }&{ action: "inbox", status: "ready" }— Emitted during and after programmatic sign-in.{ action: "logout", status: "init" | "success" | "error" }— Emitted during programmatic sign-out.
Commands Your Parent App Can Send
Send JSON objects (or JSON-stringified payloads) to the iframe via iframe.contentWindow.postMessage(...):
| Action | Payload Example | Effect |
|---|---|---|
login | { action: "login", data: { token: "<custom_token>" } } | Signs the user into WhatsBox with a Firebase custom token. |
logout | { action: "logout" } | Signs the user out and redirects the iframe to /embedded-login. |
open-thread | { action: "open-thread", data: { thread_id: "123" } } | Navigates immediately to /inbox/123. |
set-theme | { action: "set-theme", data: { theme: "dark" } } | Switches theme live (light, dark, or system). |
Troubleshooting
| Issue | Cause & Fix |
|---|---|
Iframe stays on loading spinner (/embedded-login) | No active session or ?token= was supplied. Listen for { action: "login", status: "required" } (or EMBED_READY) and post a fresh Firebase custom token via { action: "login", data: { token } }. |
Cannot open /team or /settings/billing inside iframe | Admin workspace management routes are intentionally blocked in Embedded Mode and redirect back to /inbox. |
| Theme doesn't match host application | Pass ?theme=dark (or light/system) in the iframe URL, and send { action: "set-theme", data: { theme } } whenever your host app switches themes. |