Widget
One script tag puts the assistant on any website.
<script src="https://cdn.naalyaschools.ac.ug/chat/v1/chat.js" data-key="sk_nly_..." async></script>Paste it before </head>. The Hub shows this tag ready to copy under Development > API Keys for any publishable key, and right after a publishable key is created.
| Attribute | ||
|---|---|---|
data-key | required | A publishable key whose allowed origins include this site |
data-api | optional | API base URL; only for staging |
data-position | optional | right (default) or left |
What it does
A bubble in the corner opens a panel with the assistant's name, logo and intro from the school's settings. Replies stream in; enquiries can be taken in the conversation. History stays in the browser tab. Under 640px the panel fills the screen.
Wrong key or origin: the widget shows nothing and logs one warning in the console.
Script API
window.NaalyaChat.open(), .close(), .unmount().
Pinned version
chat/v1/chat.js updates in place. To pin, use chat/<version>/chat.js with the sha384 from the release notes:
<script src="https://cdn.naalyaschools.ac.ug/chat/1.0.0/chat.js" integrity="sha384-..." crossorigin="anonymous" data-key="sk_nly_..." async></script>Platforms
- Wix: Settings, Custom code, add to Head (needs a paid plan).
- WordPress: the theme header, or a header scripts plugin.
- Anything else: where other third-party scripts go.
In code
The same widget mounts from the package, for sites that bundle their dependencies:
import { mountNaalyaChat } from '@naalya/chat/widget'
const widget = mountNaalyaChat({ apiKey: 'sk_nly_...', position: 'left' })
widget.open()