1-Line Drop-in Chatbot Widget
The ToolsWallet RAG chat widget is a self-contained, lightweight (<14 KB) drop-in script. It connects directly to your knowledge base, streams answers token-by-token, and requires zero npm dependencies or complex build steps.
How the Widget Works
When placed on your website, the widget adds a floating chat bubble in the bottom right corner. When a visitor asks a question, the widget communicates with /api/v1/query/stream to stream answers in real-time.
- •Zero Framework Lock-in: Works seamlessly on React, Vue, Svelte, Angular, WordPress, and raw HTML.
- •Live Typewriter Stream: Tokens appear word-by-word with sub-50ms first-byte speed.
- •CORS Domain Protection: Only allowed website domains can interact with your bot.
Embedding on HTML & Static Websites
Paste this single line directly before the closing </body> tag of your HTML page:
<script
src="http://localhost:8081/widget.js"
data-rag-id="YOUR_RAG_ID"
data-api-key="tw_rag_live_YOUR_KEY"
data-primary-color="#ea580c"
data-title="Support Copilot"
defer>
</script>Embedding in Next.js & React
In your Next.js app/layout.tsx or React component, add the Next.js Script component:
import Script from 'next/script';
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Script
src="http://localhost:8081/widget.js"
data-rag-id="YOUR_RAG_ID"
data-api-key="tw_rag_live_YOUR_KEY"
data-primary-color="#ea580c"
data-title="AI Support"
strategy="lazyOnload"
/>
</body>
</html>
);
}Embedding in WordPress, Shopify & Webflow
1. Go to your WordPress Admin > Theme Settings (or 'Insert Headers and Footers' plugin).
2. On Shopify, go to Online Store > Themes > Edit Code > theme.liquid.
3. Paste the script tag right above </body> and click Save. The chat widget will appear immediately on your storefront!
Customization Attributes
You can customize the widget appearance using simple HTML attributes:
| Attribute | Default | Description |
|---|---|---|
| data-rag-id | Required | Your Knowledge Base ID from Dashboard. |
| data-api-key | Required | Your active `tw_rag_live_...` API key. |
| data-primary-color | #ea580c | Hex color code for the chat bubble & header. |
| data-title | AI Assistant | The title displayed at the top of the chat window. |