{"id":51094817,"url":"https://github.com/gleanwork/sl-glean-callcenter-websdk-embedded-agent","last_synced_at":"2026-06-24T05:30:57.921Z","repository":{"id":357454179,"uuid":"1231221770","full_name":"gleanwork/sl-glean-callcenter-websdk-embedded-agent","owner":"gleanwork","description":"Call center support workspace example embedding a Glean Agent with the Web SDK.","archived":false,"fork":false,"pushed_at":"2026-05-12T20:22:34.000Z","size":788,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-12T22:17:46.380Z","etag":null,"topics":["agent","aws","cdk","cloudfront","glean","solutions-library","websdk"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gleanwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-06T18:49:30.000Z","updated_at":"2026-05-12T20:22:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gleanwork/sl-glean-callcenter-websdk-embedded-agent","commit_stats":null,"previous_names":["gleanwork/sl-glean-callcenter-websdk-embedded-agent"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/gleanwork/sl-glean-callcenter-websdk-embedded-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleanwork%2Fsl-glean-callcenter-websdk-embedded-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleanwork%2Fsl-glean-callcenter-websdk-embedded-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleanwork%2Fsl-glean-callcenter-websdk-embedded-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleanwork%2Fsl-glean-callcenter-websdk-embedded-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gleanwork","download_url":"https://codeload.github.com/gleanwork/sl-glean-callcenter-websdk-embedded-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleanwork%2Fsl-glean-callcenter-websdk-embedded-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34719086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","aws","cdk","cloudfront","glean","solutions-library","websdk"],"created_at":"2026-06-24T05:30:56.180Z","updated_at":"2026-06-24T05:30:57.909Z","avatar_url":"https://github.com/gleanwork.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Call Center Embedded Agent with the Glean Web SDK\n\nThis repository is a production-ready, customer-facing example that shows how to embed a Glean Agent into a call center support workflow using the Glean Web SDK.\n\nThe sample is intentionally static: no application backend, no API keys, and no customer-specific Glean configuration committed to source. It can be deployed as-is to AWS with CDK, then configured at runtime through URL parameters or the in-page settings dialog.\n\n## What the Example Shows\n\n- A realistic support workspace with customer details, case context, and a live transcript\n- Glean Chat embedded with `window.GleanWebSDK.renderChat(...)`\n- A \"Send transcript to AI\" action that turns in-app context into an `initialMessage`\n- Quick action buttons that open the embedded assistant with focused prompts\n- A toggleable Glean Agent pane that lets the application reclaim space when chat is closed\n- Runtime configuration for `webAppUrl`, `backend`, and `agentId`\n- AWS CDK deployment to CloudFront backed by a private S3 bucket\n\n## Screenshots\n\nDefault two-pane support workspace:\n\n![Call center workspace without the Glean Agent pane](docs/images/callcenter-workspace-default.png)\n\nWorkspace with the embedded Glean Agent pane open:\n\n![Call center workspace with the Glean Agent pane open](docs/images/callcenter-workspace-agent-open.png)\n\nWorkspace with the embedded Glean Agent pane authenticated:\n\n![Call center workspace with the Glean Agent pane authenticated](docs/images/callcenter-workspace-agent-logged-in.png)\n\n## Repository Layout\n\n```text\n.\n├── site/                         # Static website served by CloudFront\n│   ├── index.html\n│   ├── app.js\n│   └── styles.css\n├── bin/                          # CDK app entrypoint\n├── lib/                          # CDK stack\n├── scripts/                      # Validation utilities\n├── test/                         # CDK assertions\n├── AGENTS.md                     # Agent-facing repo and deploy guide\n├── README.md\n├── cdk.json\n└── package.json\n```\n\n## Prerequisites\n\n- Node.js 20 or newer\n- npm\n- AWS CLI configured with credentials for the target AWS account\n- AWS CDK bootstrap completed in the target account and region\n\nBootstrap example:\n\n```bash\nnpx cdk bootstrap aws://ACCOUNT_ID/REGION\n```\n\n## Run Locally\n\nInstall dependencies:\n\n```bash\nnpm install\n```\n\nStart a local static preview:\n\n```bash\nnpm start\n```\n\nThen open:\n\n```text\nhttp://localhost:8080\n```\n\n## Configure the Embedded Agent\n\nUse the gear icon in the page header or Agent pane, or pass values through URL parameters:\n\n```text\nhttp://localhost:8080/?webAppUrl=https%3A%2F%2Fapp.glean.com\u0026backend=https%3A%2F%2Fyour-company-be.glean.com%2F\u0026agentId=YOUR_AGENT_ID\n```\n\nConfiguration values:\n\n- `webAppUrl`: The web page where users access Glean, such as `https://app.glean.com` or a company-specific Glean web app URL.\n- `backend`: The Glean backend URL, such as `https://your-company-be.glean.com/`. Supplying this is recommended because it routes users to the correct Glean deployment.\n- `agentId`: Optional. When provided, chat uses the specified Glean Agent. When omitted, chat opens the default Glean Assistant experience.\n\nThese values are stored in `localStorage` after you apply them. Do not commit customer-specific values to this repository.\n\n## Authentication Model\n\nThis sample uses the default Glean SSO flow. If the user is not already signed in to Glean, the embedded widget prompts them to sign in.\n\nFor public sites, customer portals, or guest experiences where users should not sign in with Glean SSO, use token-based authentication instead. The Glean Web SDK supports `authMethod: \"token\"`, `authToken`, and `onAuthTokenRequired`; your backend should create short-lived tokens and never expose Glean API keys in browser code.\n\nOfficial docs:\n\n- [Glean Chat Web SDK](https://developers.glean.com/libraries/web-sdk/components/chat)\n- [Server-to-server authentication](https://developers.glean.com/libraries/web-sdk/authentication/server-to-server)\n- [ChatOptions reference](https://app.glean.com/meta/browser_api/interfaces/ChatOptions.html)\n\n## Validate\n\nRun all local checks:\n\n```bash\nnpm run check\nnpm run audit\nnpm run build\nnpm test\nnpm run cdk:synth\n```\n\n## Deploy with CDK\n\nDeploy to the default CloudFront domain:\n\n```bash\nnpm run cdk:deploy\n```\n\nThe deployment outputs:\n\n- `CloudFrontUrl`: the default deployed site URL\n- `SiteBucketName`: the private S3 bucket that stores static assets\n- `CustomDomainUrl`: only when a custom domain is configured\n\nDestroy the stack:\n\n```bash\nnpm run cdk:destroy\n```\n\nBy default, the S3 bucket is retained when the stack is destroyed. This is safer for production deployments because it prevents accidental asset deletion. For short-lived demo stacks where cleanup is desired, deploy with:\n\n```bash\nnpm run cdk:deploy -- -c siteRemovalPolicy=destroy\n```\n\nOnly use `siteRemovalPolicy=destroy` for disposable environments.\n\n## Custom Domain Deployment\n\nThe default deployment works without a custom domain. For customer-owned domains, collect these values before deploying:\n\n- Target domain name, for example `support-ai.example.com`\n- Whether DNS is hosted in Route53\n- If Route53-managed: hosted zone ID and hosted zone name\n- ACM certificate ARN for the target domain\n\nImportant: CloudFront requires the ACM certificate to be in `us-east-1`.\n\nDeploy with a custom domain and Route53-managed DNS:\n\n```bash\nnpm run cdk:deploy -- \\\n  -c domainName=support-ai.example.com \\\n  -c certificateArn=arn:aws:acm:us-east-1:123456789012:certificate/abc123 \\\n  -c hostedZoneId=Z1234567890ABC \\\n  -c hostedZoneName=example.com\n```\n\nDeploy with a custom domain but externally managed DNS:\n\n```bash\nnpm run cdk:deploy -- \\\n  -c domainName=support-ai.example.com \\\n  -c certificateArn=arn:aws:acm:us-east-1:123456789012:certificate/abc123\n```\n\nAfter deploy, create the required DNS record with your DNS provider pointing the custom domain to the CloudFront distribution domain output by CDK.\n\n## Embedding in Another Portal\n\nThe default CloudFront security headers allow the site to frame itself only. If you need to embed the deployed site in another portal, pass a comma-separated list of allowed frame ancestors:\n\n```bash\nnpm run cdk:deploy -- -c frameAncestors=https://solutions.example.com\n```\n\nKeep this list as narrow as possible.\n\n## How Context Is Sent to the Agent\n\nThe important pattern is in `site/app.js`:\n\n```js\nsdk.renderChat(elements.chat, buildChatOptions(latestConfig, initialMessage));\n```\n\nWhen a support rep clicks \"Send transcript to AI\", the sample builds a prompt from the visible case context and transcript, then renders chat with that prompt as `initialMessage`. In a production application, you can build the same message from selected records, form state, CRM objects, or any other context the user is already working with.\n\n## Security Notes\n\n- Do not hardcode private Agent IDs, backend URLs, API keys, AWS account IDs, or customer data in source.\n- Keep server-to-server token creation on your backend. Browser code should only receive short-lived auth tokens.\n- The CDK stack deploys a private S3 bucket and serves the site through CloudFront Origin Access Control.\n- The CDK stack retains the S3 bucket by default on destroy. Use `-c siteRemovalPolicy=destroy` only for disposable demo environments.\n- Update the Content Security Policy in `site/index.html` and `lib/static-site-stack.ts` if your Glean deployment, asset host, or app domain differs from the default sample.\n- Treat `initialMessage` as user-visible prompt content. Avoid sending sensitive context unless your application has already authorized the current user to access it.\n- Report security issues privately. See `SECURITY.md`.\n\n## For Coding Agents\n\nRead `AGENTS.md` before editing or deploying this repository. It includes the architecture, safe-edit constraints, validation commands, and deployment questions agents should ask before custom-domain deployment.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgleanwork%2Fsl-glean-callcenter-websdk-embedded-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgleanwork%2Fsl-glean-callcenter-websdk-embedded-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgleanwork%2Fsl-glean-callcenter-websdk-embedded-agent/lists"}