Embed the Recorder widget
Mount the Recorder widget in your product, pass it the container’s edit key, and react as soon as a message is recorded.
Prerequisites
A container you already created, with its urid and editKey — see Make your first API request.
Create the container
As in Make your first API request, POST to /containers to get the container’s urid and its editKey. editKey is only returned at creation, so capture it now — you will need it in a later step.
curl -X POST https://client-api.v5.livstick.com/api/v3/containers \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{ "crid": "welcome-message" }'
Mount the widget
The package ships three ways to mount it: an SSR-safe React component for React apps, a Shadow DOM Custom Element for any other stack, or the classic loader on a fullpage.html page for iframe embeds. Pick the one that matches your context. If you mount it in an iframe, the host page must grant allow="camera; microphone" — without it, the camera and microphone silently fail to start.
import { defineLivstickWidget } from "@livstick/widget-react-v2/element";
defineLivstickWidget();
// then in your markup:
// <livstick-widget-v2 uid="code" domain="example.com"></livstick-widget-v2>
Pass the edit key and your configuration
config, editKey, and replyToken are exclusively JavaScript properties on the element — the widget never reads them from HTML attributes. Set them once you hold a reference to the element, using the editKey you captured when you created the container.
const widget = document.querySelector("livstick-widget-v2");
widget.config = { version: 2, behavior: { messageEnabled: true } };
widget.editKey = editKey;
Listen for the recorded event
The widget fires four composed events: livstick:ready, livstick:route-change, livstick:recorded, and livstick:error. Listen for livstick:recorded to know a message has been captured, and update your own interface.
widget.addEventListener("livstick:recorded", () => {
// message captured — update your interface here
});
Next steps
Compare the mounting options in more depth — React component, Custom Element, or iframe — before you settle on one across your surfaces. See “Choosing an integration mode.”