@vamlabs/vam-chatbot
v0.1.77
Published
VAM Chatbot Web Component
Downloads
847
Readme
Steps to use the VAM Chatbot
Import the Package:
- To import the VAM chatbot package, add the following
<script>tag to the<head>section of your root HTML file. This will load the package from our CDN:<script src="https://cdn.jsdelivr.net/npm/@vamlabs/vam-chatbot/dist/web-component.min.js"></script>
- To import the VAM chatbot package, add the following
Place the Floating Chatbot Component:
- Insert the chatbot component into your HTML. By default, it appears as a minimized launcher at the bottom right of the screen. Replace the
client-idwith your specific client ID:<vam-chatbot client-id="<your-client-id>"></vam-chatbot>
- Insert the chatbot component into your HTML. By default, it appears as a minimized launcher at the bottom right of the screen. Replace the
Place the Inline Chatbot Component:
- For an in-page chatbot that sits wherever you place it in the page layout, use
layout="inline":<vam-chatbot layout="inline" client-id="<your-client-id>" class="my-inline-chatbot" ></vam-chatbot> - Inline layout reserves its page space immediately at
100%width with a default height of640px, then keeps that footprint while loading, ready, or temporarily unavailable. Use CSS variables and exposed shadow parts for customization. Scope inline-only overrides with[layout="inline"]:vam-chatbot[layout="inline"].my-inline-chatbot { --chatbot-inline-height: 720px; } vam-chatbot[layout="inline"].my-inline-chatbot::part(panel) { border-radius: 0; box-shadow: none; } vam-chatbot[layout="inline"].my-inline-chatbot::part(header) { background: #0500ff; }
- For an in-page chatbot that sits wherever you place it in the page layout, use
Provide an Auth Token (Optional):
- For protected deployments (for example, your portal domain), pass a bearer token for
POST /chat/session. - For public embeds where your backend allows unauthenticated session minting, this can be omitted.
- Static token via attribute:
<vam-chatbot client-id="<your-client-id>" auth-token="<id-token>"></vam-chatbot> - Recommended (fresh token per request) via JS property:
<script> const bot = document.querySelector("vam-chatbot"); bot.authTokenProvider = async () => { return window.getCognitoIdToken(); }; </script>
- For protected deployments (for example, your portal domain), pass a bearer token for
These steps will help you integrate the VAM chatbot into your webpage seamlessly. Ensure you replace the client-id with the one provided to you for proper configuration.
Notes
- The widget uses a 2-step chat flow (
POST /chat/sessionthen streamedPOST /chat/stream) and requires your site origin to be allowlisted for your tenant. - If configured,
authTokenProvideris called before each message stream starts so expiring tokens can be refreshed on-demand. - Missing or invalid
layoutvalues default to the existing floating layout. - Exposed
::part(...)hooks includeroot,panel,header,header-title,header-actions,reset-button,close-button,body,inline-state,loading-state,error-state,conversation,prompts,prompt-button,message,bot-message,user-message,error-message,message-avatar,message-bubble,carousel,sources,source-link,source-toggle,promoted-topics,support-actions,feedback-form,footer,footer-branding,prompt-drawer-button,input,submit-button,launcher,launcher-popup, andlauncher-button.
