Install

Web Component

Embed the widget as a custom element — attributes, events, and the identify() method

The Web Component embed registers a wexio-widget custom element backed by Shadow DOM. It's framework-agnostic — drop it into Vue, Angular, Svelte, or plain HTML.

Basic embed

Load the module once, then place the element anywhere in your markup:

<script type="module" src="https://cdn.wexio.io/widget/widget.js"></script>

<wexio-widget public-key="pk_live_..."></wexio-widget>

Attributes

These attributes are observed live — changing them re-resolves config without unmounting the widget:

AttributeDefaultBehaviour
public-keyYour widget's public key. Omit or leave empty for the demo fallback.
localeautoForce a UI locale (a BCP-47 code). Overrides the operator's locale strategy. See Localization.
prefill-nameUnverified prechat prefill.
prefill-emailUnverified prechat prefill.
prefill-phoneUnverified prechat prefill.
<wexio-widget public-key="pk_live_..." locale="pt-BR"></wexio-widget>

Identifying a visitor

The element exposes an identify() method. Pass a VisitorIdentity to sign a visitor in, or null to log out:

const el = document.querySelector("wexio-widget");

el.identify({ jwt: "<host-signed-jwt>", name: "Ada Lovelace" });

// later, on logout:
el.identify(null);

See Authentication for how to produce the proof.

Events

The element dispatches custom events (they bubble and cross shadow boundaries):

Eventevent.detailWhen
wexio:resize{ width, height }The panel's dimensions changed.
wexio:closeThe visitor closed the panel.
el.addEventListener("wexio:resize", (e) => {
  console.log("panel size", e.detail.width, e.detail.height);
});

Pre-boot settings

You can pass identity, prefill, and even a pre-resolved config before the element mounts by setting window.wexioSettings:

<script>
  window.wexioSettings = {
    user: { jwt: "<host-signed-jwt>", name: "Ada" },
    config: { /* InjectableWidgetConfig — skips the bootstrap fetch */ },
  };
</script>
<script type="module" src="https://cdn.wexio.io/widget/widget.js"></script>
<wexio-widget public-key="pk_live_..."></wexio-widget>

Passing a config object skips the GET /api/web/config/:pk bootstrap fetch — handy when you already have the config server-side. See the config reference.

On this page