04 / Chat widget
Inline Widget Demo
Embed the Synaplan chat widget with one script tag, then open, close and reset it from your own UI — live on this page.
On this page 5
Try it on this page#
This page runs the real widget — the button in the bottom-right corner. Drive it from your own UI with the JavaScript API:
// Calls appear here.
Note
A widget only answers on the domains it is configured for. Running these docs on
localhost, the button opens but the bot replies with an error — that is expected.
Embed in one script tag#
The widget is an ES module. Add it anywhere before </body>:
<script type="module">
import SynaplanWidget from 'https://web.synaplan.com/widget.js'
SynaplanWidget.init({
widgetId: 'YOUR_WIDGET_ID',
primaryColor: '#1a1ae8'
})
</script>
Replace YOUR_WIDGET_ID with the ID from Widgets in your Synaplan dashboard (it starts with wdg_).
Full example#
Branding, greeting and limits in one call — every option is listed in the Widget API Reference:
<script type="module">
import SynaplanWidget from 'https://web.synaplan.com/widget.js'
SynaplanWidget.init({
widgetId: 'wdg_095ab093966991158f9957f42ae8b4f2',
position: 'bottom-right',
primaryColor: '#1a1ae8',
iconColor: '#ffffff',
defaultTheme: 'dark',
autoOpen: false,
autoMessage: 'Hi! How can I help you today?',
messageLimit: 50,
maxFileSize: 10,
allowFileUpload: false,
lazy: true
})
</script>
Your own button#
Hide the floating button and open the chat from anything on your page:
<button id="my-chat-btn">Chat with us</button>
<script type="module">
import SynaplanWidget from 'https://web.synaplan.com/widget.js'
SynaplanWidget.init({
widgetId: 'wdg_...',
hideButton: true
})
document.getElementById('my-chat-btn')
.addEventListener('click', () => SynaplanWidget.open())
</script>
What you get#
- ES module — a modern import with automatic code-splitting.
- Lazy loading — the chat UI loads only on the first click.
- Automatic API detection — no URL configuration needed.
- Remote config — dashboard changes apply without touching the embed code.
- File upload — PDFs, Word documents and images, when enabled.
- Responsive — desktop, tablet and mobile.
- Theming — light and dark, or follow the host page.