Guide
Embed the chat widget
One script tag. The widget reads its configuration from your account at load time: template, colours, welcome message: so changes made in the dashboard apply without touching the snippet.
Overview
The widget is a single JavaScript file that injects a floating bubble and talks to POST /projects/{project_id}/chat/stream. It identifies itself by the project UID and by the domain of the page it runs on: no key at all. The server checks that the referring domain is registered for the project before answering.
The configuration is fetched at load, not baked into the snippet. Change the greeting in the dashboard and every page already carrying the tag picks it up on the next visit: no re-deploy of the host site.
Origin or Referer is not registered is refused. Register the domain in Integrations before shipping, or the widget will answer nothing.Embed the widget
Paste this before </body>:
<!-- Get your integration ID by creating a Widget integration in Integrations -->
<script
async
src="https://widget.querymindx.tech/widget/roomy-widget-conversational.js"
data-website-id="XXXX-XXXX-XXXX-XXXX-XXXX"
data-project-name="My assistant"
data-project-color="#2f4b3f"
></script>On first paint the widget reads its configuration through the public proxy route GET /widget/{website_id}/config, which returns the template, colours and greeting stored for that project. If that call fails it renders with built-in defaults rather than not rendering at all.
Script attributes
Session and visitor state
The widget keeps two values in localStorage: a visitor id that stays stable across visits, and a session id that identifies the current conversation. Passing data-session-id overrides the latter, which is how you resume a specific thread.
Clearing site data starts a new conversation. That is the supported way to reset: there is no "new chat" API on the widget.
Using it from React
Load the script once, in the component that owns the page. Doing it in a component that re-renders will inject the widget twice.
import { useEffect } from 'react';
export function ChatWidget() {
useEffect(() => {
if (document.getElementById('roomy-widget')) return; // déjà chargé
const s = document.createElement('script');
s.id = 'roomy-widget';
s.src = 'https://widget.querymindx.tech/widget/roomy-widget-conversational.js';
s.async = true;
s.dataset.websiteId = process.env.NEXT_PUBLIC_QUERYMIND_PROJECT_ID!;
s.dataset.projectName = 'My assistant';
document.body.appendChild(s);
}, []);
return null;
}Troubleshooting
Nothing renders
Check the console for data-website-id est requis. It means the attribute is missing, or the script ran before the tag that sets it. A 403 instead means the page domain is not registered for that project.
The widget appears but answers nothing
The key resolved to no account, or the monthly quota is exhausted. Both surface on the stream rather than as a network error, so check the network tab for the error event.
Two bubbles on the page
The script was injected twice: usually a React component that mounts more than once. Guard with an id check, as in the example above.
