Your team lives in an internal tool and context-switches to find answers. Instead of sending them elsewhere, bring Glean's answers into the app they already use — with permissions enforced per user, automatically.
Install the Web SDK: add the npm package to your app. It ships TypeScript types for every component and option.
npm install @gleanwork/web-sdk
No build toolchain (CMS, portal, SharePoint)? Load the SDK from your Glean
domain with a script tag instead — the same methods appear on
window.GleanWebSDK. See the Web SDK overview.
Render search: add a search box and a results container, then render both
components. Setting backend is recommended — it routes users straight to
your instance instead of asking for their email. See the
Autocomplete + Search Page guide
for the full options.
import { renderSearchBox, renderSearchResults } from '@gleanwork/web-sdk';
renderSearchBox(searchBoxElement, {
backend: 'https://{your}-be.glean.com',
onSearch: (query) => {
renderSearchResults(resultsElement, { query });
},
});
Render chat: create a container element with position: relative,
display: block, and an explicit width and height, then render Glean Chat
into it.
import { renderChat } from '@gleanwork/web-sdk';
renderChat(containerElement, {
backend: 'https://{your}-be.glean.com',
});
Authenticate users: with the default setup, users authenticate through your
company's SSO — no extra configuration. To skip the SSO prompt (or support
users without Glean accounts), use
server-to-server authentication:
your backend mints short-lived user tokens with an admin API key
(SEARCH and CHAT scopes). Keep that key strictly server-side.
Try it with a query like "What is our PTO policy?" — results reflect exactly what the signed-in user is permitted to see.
applicationId to the chat component.Copies a prompt your AI assistant can build from.