https://github.com/getknoku/widget
Embeddable AI chat widget for documentation sites. CDN script or npm import
https://github.com/getknoku/widget
ai chatbot docs documentation widget
Last synced: 8 days ago
JSON representation
Embeddable AI chat widget for documentation sites. CDN script or npm import
- Host: GitHub
- URL: https://github.com/getknoku/widget
- Owner: getknoku
- License: mit
- Created: 2026-04-27T23:47:47.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-10T08:02:11.000Z (about 2 months ago)
- Last Synced: 2026-05-10T10:10:21.969Z (about 2 months ago)
- Topics: ai, chatbot, docs, documentation, widget
- Language: TypeScript
- Homepage: https://knoku.com
- Size: 252 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Knoku Widget
Embeddable Knoku chat widget. The package supports two delivery modes:
- CDN / script tag: `dist/widget.js`
- npm / app integration: `@knoku/widget`
Full documentation: [docs.knoku.com/widget](https://docs.knoku.com/widget).
## CDN usage
```html
```
The loader reads widget settings from `data-*` attributes, fetches `/api/v1/config/{projectId}` for server-controlled status and plan policy, and skips mounting when the project/widget is inactive or the current domain is not allowed.
Add a custom site button in addition to the default launcher:
```html
Ask AI
```
Add `data-launcher-hidden="true"` only if you want to hide the default bottom launcher.
Language defaults to browser detection and can be overridden with `data-language`.
## npm usage
```bash
npm install @knoku/widget
```
```ts
import { initKnokuWidget } from '@knoku/widget'
await initKnokuWidget({
projectId: 'YOUR_PROJECT_ID',
})
```
Use the npm API for documented per-page overrides such as `greeting` and `language`.
If you already own the host Shadow DOM, use the lower-level mount API:
```ts
import { mountKnokuWidget, createWidgetConfig } from '@knoku/widget'
const host = document.getElementById('widget-host')
if (host) {
const shadow = host.attachShadow({ mode: 'open' })
mountKnokuWidget(
shadow,
createWidgetConfig({ projectId: 'YOUR_PROJECT_ID' })
)
}
```
## Programmatic controls
After mount, the widget exposes `window.Knoku`:
```ts
window.Knoku.open()
window.Knoku.close()
window.Knoku.toggle()
window.Knoku.ask('How do I self-host?')
window.Knoku.identify({ id: 'user_123', email: 'user@example.com' })
```
## Build
```bash
npm run build
```
Build outputs:
- `dist/widget.js` - standalone script-tag loader bundle
- `dist/index.js` - ESM package entry
- `dist/*.d.ts` - TypeScript declarations
## Issues & Contributing
Report bugs or request features at [github.com/getknoku/widget/issues](https://github.com/getknoku/widget/issues).
## License
MIT — see [LICENSE](./LICENSE).