SDK
Install and drive the widget from your application code.
npm install @assistifychat/widgetimport { mount } from '@assistifychat/widget';
const widget = mount({ widgetId: 'WIDGET_ID' });
widget.chat.open();Find your widget ID in the dashboard under Widget → Settings → Credentials.
mount() returns synchronously; methods called before the widget has booted are queued and replayed in order once it is ready. Outside the browser, mount() returns a no-op handle, so the same code can run during server-side rendering.
Calling mount() again after destroy() re-establishes the runtime in the same page session, useful for SPA routes that drop the widget and bring it back on a different page.
Using React? See React for AssistifyScript and useAssistify.
Options
| Option | Type | Default | |
|---|---|---|---|
widgetId | string | required | |
baseUrl | string | https://assistify.chat | |
autoload | boolean | true | See Deferred boot |
launcher | boolean | true | Set to false to render the panel without the floating launcher. See Panel-only. |
identity | WidgetIdentity | Identity sent with the boot request. Without a valid userHash it is discarded and the session starts anonymous. See Identity verification. |
Full method and event list: JavaScript API.
Panel-only (custom launcher)
Set launcher: false to render the chat panel without the floating launcher. Nothing appears until you open the widget, so you can trigger it from your own button or menu item:
const widget = mount({ widgetId: 'WIDGET_ID', launcher: false });
document.querySelector('#help').addEventListener('click', () => widget.chat.open());The option applies to this embed only, so the same widget keeps its launcher on other pages. Combine it with autoload: false to hold all network activity until the first open. Closing the panel with the close button or the Escape key hides it completely, and you can listen for the close event when your button needs to reflect the open state.
Deferred boot
Pass autoload: false and the loader script is not injected at mount time. The handle is still returned synchronously, so the rest of your app can wire up event subscriptions without triggering any network activity.
const widget = mount({ widgetId: 'WIDGET_ID', autoload: false });
widget.events.on('ready', () => console.log('Widget is ready'));Boot happens the first time a host calls one of these:
| Method | Triggers boot? |
|---|---|
chat.open() / chat.close() / chat.toggle() | ✅ |
load() | ✅ |
reset() | ❌ clears local visitor storage; boots only once the widget is on the page |
events.on() / events.off() | ❌ buffered |
user.identify() | ❌ buffered; the identity is included in the boot request |
user.getVisitorId() | ❌ reads stored ID directly |
isReady() / destroy() | ❌ |
Buffered calls reach the runtime on first boot in the order they were made.
Boot on consent
const widget = mount({ widgetId: 'WIDGET_ID', autoload: false });
cmp.onConsentGranted('chat', () => {
widget.load();
});Nothing happens until consent is granted.
Boot when an identity becomes available
const widget = mount({ widgetId: 'WIDGET_ID', autoload: false });
auth.onSignIn(({ user, userHash }) => {
widget.user.identify({ email: user.email, userHash });
widget.load();
});Identity supplied through user.identify() before boot is included in the boot request itself, so the visitor is already verified when the widget first renders.
Tell your visitors
Your privacy policy should mention the chat. See Visitor recognition → Your privacy policy for the two notices to link.