JAVASCRIPT SDK
Build support into your product
Add TruCom to your website, connect customer context, and make support feel like part of your app.
Start with your widget
Create a workspace, open Settings → Chat widget and copy your installation snippet. Add your website to Allowed domains. The public widget key identifies your installation; signing secrets stay on your server.
HTML / JavaScript
<script>
window.TruComWidgetConfig = { color: '#111111' };
window.TruComWidget = window.TruComWidget || { q: [] };
TruComWidget.q.push(['on', 'ready', function (event) {
console.log('Support is ready');
}]);
</script>
<script async src="https://trucom.app/widget/loader.js"
data-trucom-widget="YOUR_WIDGET_PUBLIC_KEY"></script>Use the JavaScript API
The full snippet copied from Settings includes an early-call bootstrap. With that snippet, calls queue until the loader and iframe are ready. The shorter example above uses the q queue explicitly.
JavaScript
TruComWidget.q.push(['identify', {
name: 'John Doe',
email: '[email protected]',
attributes: { plan: 'Business', orders: 12 }
}]);
TruComWidget.q.push(['open']);Learn the building blocks
- Configuration changes the current installation without changing saved workspace settings.
- Methods perform actions and return promises, except documented synchronous state and subscription methods.
- Events let your product react to support activity.
- Signed identity authorizes customer history. Plain name, email and custom attributes provide context.
SDK version 1.0.0
This guide documents the JavaScript widget SDK and the native WebView bridge. Existing loader snippets and open, close, identify and reset integrations remain compatible.