Reference

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";
PropTypePurpose
publicKeystringIntegration key. Omit for demo mode.
userVisitorIdentityKnown-visitor proof. Memoise it.
configInjectableWidgetConfigPre-resolved config; skips the bootstrap fetch.
onResize(size: { width: number; height: number }) => voidPanel dimensions changed.
onOpen() => voidPanel opened.
onClose() => voidPanel closed.
classNamestringOuter host element class.
styleReact.CSSPropertiesOuter host element styles.

Web component

Element: wexio-widget (registered by https://cdn.wexio.io/widget/widget.js).

Attributes (observed live)

AttributePurpose
public-keyIntegration key.
localeForce a UI locale (BCP-47).
prefill-name / prefill-email / prefill-phoneUnverified prechat prefill.

Method

element.identify(user: VisitorIdentity | null): void;  // null = log out

Events

EventdetailWhen
wexio:resize{ width, height }Panel resized.
wexio:closePanel closed.

Loader script

<script src="https://cdn.wexio.io/widget/loader.js" data-public-key="pk_live_..."></script>

Data attributes

AttributeDefaultPurpose
data-public-keyrequiredIntegration key.
data-originhttps://cdn.wexio.ioWidget CDN base.
data-apihttps://api.wexio.ioBackend API base.
data-hide-attributionfalseHide the visible attribution chip.

window.Wexio(action, …)

ActionArgumentEffect
"identify"VisitorIdentity | nullLog 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:

TypePayload
wexio:identify:v1{ user: VisitorIdentity }
wexio:prefill:v1{ prefill }
wexio:shutdown:v1

Widget → loader:

TypePayload
wexio:widget:ready:v1
wexio:widget:open:v1
wexio:widget:close:v1
wexio:widget:resize:v1{ width, height }

Bootstrap endpoints

EndpointPurpose
GET /api/web/config/:publicKeyFull sanitised widget config.
GET /api/web/config/:publicKey?view=gateSlim pre-mount payload (status, branding.hidden, security).
POST /api/web/visitor/start-identifiedIdentified handshake.
POST /api/web/visitor/start-anonymousAnonymous handshake.
GET /api/web/realtime/:chatIdServer-sent events stream for live messages.

On this page