API Reference
Every React prop, web-component attribute and event, loader attribute and action, and postMessage type
The complete embed surface across every delivery mode. For installs and examples, see Install.
The framework packages (React, Vue, Angular, Ember) all wrap the same Web Component below, so they share the same attributes and events under idiomatic names (props/emits, @Input/@Output, {{on}}). React props are documented here; the per-framework install pages list each framework's exact names.
React component props
import { WexioWidget } from "@wexio/messenger-widget-react";| Prop | Type | Purpose |
|---|---|---|
publicKey | string | Integration key. Omit for demo mode. |
user | VisitorIdentity | Known-visitor proof. Memoise it. |
config | InjectableWidgetConfig | Pre-resolved config; skips the bootstrap fetch. |
onResize | (size: { width: number; height: number }) => void | Panel dimensions changed. |
onOpen | () => void | Panel opened. |
onClose | () => void | Panel closed. |
className | string | Outer host element class. |
style | React.CSSProperties | Outer host element styles. |
Web component
Element: wexio-widget (registered by https://cdn.wexio.io/widget/widget.js).
Attributes (observed live)
| Attribute | Purpose |
|---|---|
public-key | Integration key. |
locale | Force a UI locale (BCP-47). |
prefill-name / prefill-email / prefill-phone | Unverified prechat prefill. |
Method
element.identify(user: VisitorIdentity | null): void; // null = log outEvents
| Event | detail | When |
|---|---|---|
wexio:resize | { width, height } | Panel resized. |
wexio:close | — | Panel closed. |
Loader script
<script src="https://cdn.wexio.io/widget/loader.js" data-public-key="pk_live_..."></script>Data attributes
| Attribute | Default | Purpose |
|---|---|---|
data-public-key | required | Integration key. |
data-origin | https://cdn.wexio.io | Widget CDN base. |
data-api | https://api.wexio.io | Backend API base. |
data-hide-attribution | false | Hide the visible attribution chip. |
window.Wexio(action, …)
| Action | Argument | Effect |
|---|---|---|
"identify" | VisitorIdentity | null | Log a known visitor in / out. |
"prefill" | { name?, email?, phone? } | Update prechat prefill. |
"shutdown" | — | Clear identity, start fresh anonymous session. |
"show" | — | Show the iframe. |
"hide" | — | Hide the iframe. |
VisitorIdentity
interface VisitorIdentity {
// Provide exactly one proof (precedence: googleIdToken → jwt → userId+userHash):
googleIdToken?: string;
jwt?: string;
userId?: string;
userHash?: string;
// Optional profile on any path:
name?: string;
email?: string;
phone?: string;
attributes?: Record<string, unknown>;
}See Authentication.
Pre-boot settings
interface Window {
wexioSettings?: {
user?: VisitorIdentity;
prefill?: { name?: string; email?: string; phone?: string };
config?: InjectableWidgetConfig;
};
}postMessage protocol
The iframe loader and the widget communicate over versioned postMessage types. You don't normally call these directly — they're listed for debugging.
Loader → widget:
| Type | Payload |
|---|---|
wexio:identify:v1 | { user: VisitorIdentity } |
wexio:prefill:v1 | { prefill } |
wexio:shutdown:v1 | — |
Widget → loader:
| Type | Payload |
|---|---|
wexio:widget:ready:v1 | — |
wexio:widget:open:v1 | — |
wexio:widget:close:v1 | — |
wexio:widget:resize:v1 | { width, height } |
Bootstrap endpoints
| Endpoint | Purpose |
|---|---|
GET /api/web/config/:publicKey | Full sanitised widget config. |
GET /api/web/config/:publicKey?view=gate | Slim pre-mount payload (status, branding.hidden, security). |
POST /api/web/visitor/start-identified | Identified handshake. |
POST /api/web/visitor/start-anonymous | Anonymous handshake. |
GET /api/web/realtime/:chatId | Server-sent events stream for live messages. |