The Glean Web SDK enables integration of AI powered search and chat functionalities into your existing intranet portal. The toolkit offers different variants to suit various use-cases and provide a streamlined search experience.
We recommend to use the @gleanwork/web-sdk
when integrate with Glean, it will provide proper type support as well.
Install the Glean Web SDK with the following command:
// npm
npm install @gleanwork/web-sdk
// yarn
yarn add @gleanwork/web-sdk
// pnpm
pnpm add @gleanwork/web-sdk
// Can import all methods in one namespace GleanWebSDK
import GleanWebSDK, { type ModalSearchOptions } from "@gleanwork/web-sdk"
const optionalModalSearchOptions: ModalSearchOptions = {
// ...
}
GleanWebSDK.attach(document.getElementById('search-box'), optionalModalSearchOptions)
// or can import individual methods instead
import { attach, type ModalSearchOptions } from "@gleanwork/web-sdk"
attach(document.getElementById('search-box'), optionalModalSearchOptions)
If npm is not a viable solution, you can also integrate Glean via script tag, just include the JS library in the
of your page, where YOUR_GLEAN_DOMAIN is where your company accesses Glean, such as app.glean.com, {company}.glean.com. <script
src="https://{YOUR_GLEAN_DOMAIN}/sdk/glean-web-sdk-<version>.min.js"
></script>
This will provide all the methods available in NPM package via window.GleanWebSDK
,
other than that, the usage will remain the same.
Details on usage can found on https://developers.glean.com/docs/browser_api/