The chat widget snippet
The widget is the query endpoints with a chat interface already built. You paste two tags into your page; visitors ask questions and see the same grounded answers and citations they would in the workspace, drawn from the knowledge base's Public documents only.
Elie writes the snippet for you. To produce one and issue the token it needs, follow Developer access and widget tokens. This page is the reference for what the snippet contains.
The snippet
<div id="ask-elie-chat"></div>
<script src="https://api.example.com/widget/ask-elie-chat-widget.min.js"></script>
<script>
AskElieChat.mount('#ask-elie-chat', {
apiBaseUrl: 'https://api.example.com',
kbId: 'kb_01J...',
token: '...',
brandColor: '#005597',
position: 'bottom-right'
});
</script>
The snippet Elie generates already carries your own API address where this one shows
api.example.com.
Mount options
AskElieChat.mount takes a CSS selector or an element, then these options.
| Option | Required | What it does |
|---|---|---|
apiBaseUrl | Yes | Your Elie API base: the workspace address with tenant replaced by api. |
kbId | Yes | Which knowledge base the widget asks. |
token | Yes | The scoped token. It works only from a domain on its list. |
brandColor | No | Launcher and header colour. The snippet form asks for a hex colour, #rgb or #rrggbb, and only a hex colour gets a readable text colour picked for it automatically. |
position | No | bottom-right or bottom-left. Anything else is treated as bottom-right. |
title | No | Panel header text. Defaults to Ask. The generated snippet leaves it out; add it by hand. |
mount returns an object with update, for changing options such as a fresh token, and
unmount, for removing the widget.
The token expires: plan for it
A scoped token lasts only as long as the platform limit allows, 60 minutes by default, so a snippet pasted into a page stops working within the hour. That suits a demo, a pilot page or an internal site someone refreshes, and not a public site left unattended.
For a public site, have your own server hand the page a fresh token: generate the snippet with a
placeholder and fill in token from your backend when the page renders. Your backend still
cannot issue tokens on its own today; see the limits on the
widget API overview.
The page's domain must also be on the knowledge base's Allowed origins (CORS) list, or the browser refuses the widget's calls before the token is even checked. The same overview explains how to get it added.
Nothing about the widget widens access. The domains decide which pages may load it; what it can read is decided in Elie, and documents restricted to roles, departments or groups stay invisible.
Next
- Developer access and widget tokens - issuing and revoking.
- Errors - what an expired token looks like.