Embed the chat widget (for developers)
Script tag, iframe, allowed origins and the postMessage API.
Embed the chat widget (for developers)
Script tag (recommended)
<script
src="https://answerridge.com/widget/loader.js"
data-tenant="YOUR_TENANT"
data-accent="#0E9E94"
defer>
</script>
Iframe
<iframe
src="https://answerridge.com/embed/chat?tenant=YOUR_TENANT"
style="border:0;width:100%;height:600px"
title="Support chat"
allow="clipboard-write">
</iframe>
Allowed origins
Add every domain that will host the widget to Allowed origins in Live Chat settings. Requests from unlisted origins are rejected — this prevents others from embedding your widget.
postMessage API
The embedded chat communicates with the host page via postMessage. Useful messages:
// open the widget programmatically
iframe.contentWindow.postMessage({ type: "open" }, "https://answerridge.com");
// pass known customer identity (so tickets attach to the right person)
iframe.contentWindow.postMessage({
type: "identify",
email: "jane@example.com",
name: "Jane Doe"
}, "https://answerridge.com");
Listen for { type: "ready" } before sending messages to the iframe.