Glean Web SDK
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.
NPM
We recommend to use the @gleanwork/web-sdk when integrate with Glean, it will provide proper type support as well.
Installation
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
Usage
import GleanWebSDK, { type ModalSearchOptions } from "@gleanwork/web-sdk"
const optionalModalSearchOptions: ModalSearchOptions = {
}
GleanWebSDK.attach(document.getElementById('search-box'), optionalModalSearchOptions)
import { attach, type ModalSearchOptions } from "@gleanwork/web-sdk"
attach(document.getElementById('search-box'), optionalModalSearchOptions)
Script tag
If npm is not a viable solution, you can also integrate Glean via script tag, just
include the JS library in the <head> 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.
Documentation
Details on usage can found on https://developers.glean.com/docs/browser_api/