
Research
/Security News
TensorLake npm SDK Compromised in ChainDrop Shai-Hulud Credential-Stealing Attack
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.
@astermind/chatbot-template
Advanced tools
Embeddable AI chatbot widget for AsterMind RAG - a drop-in chat UI that connects to your AsterMind backend with full agentic capabilities.
/api/external/chat endpointsnpm install @astermind/chatbot-template
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@astermind/chatbot-template/dist/astermind-chatbot.css">
<script src="https://cdn.jsdelivr.net/npm/@astermind/chatbot-template/dist/astermind-chatbot.min.js"></script>
import { ChatbotWidget } from '@astermind/chatbot-template';
import '@astermind/chatbot-template/styles';
function App() {
return (
<ChatbotWidget
apiUrl="https://your-api-url.com"
apiKey="am_your-api-key"
position="bottom-right"
greeting="Hi! How can I help you today?"
/>
);
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@astermind/chatbot-template/dist/astermind-chatbot.css">
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/@astermind/chatbot-template/dist/astermind-chatbot.min.js"></script>
<script>
AsterMindChatbot.init({
apiUrl: 'https://your-api-url.com',
apiKey: 'am_your-api-key',
position: 'bottom-right',
greeting: 'Hi! How can I help you today?'
});
</script>
</body>
</html>
| Option | Type | Description |
|---|---|---|
apiKey | string | Your AsterMind API key (starts with am_) |
apiUrl | string | Backend API URL (e.g., https://api.example.com) |
| Option | Type | Default | Description |
|---|---|---|---|
position | 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'bottom-right' | Widget position on screen |
greeting | string | 'Hi! How can I help you today?' | Initial greeting message |
placeholder | string | 'Type your message...' | Input placeholder text |
headerTitle | string | 'AsterMind' | Chat window header title |
headerSubtitle | string | 'AI Assistant' | Chat window header subtitle |
defaultOpen | boolean | false | Start with chat window open |
showPoweredBy | boolean | true | Show "Powered by AsterMind" badge |
zIndex | number | 9999 | Z-index for the widget |
Customize appearance via the theme object:
{
theme: {
primaryColor: '#4F46E5', // Primary brand color
primaryHover: '#4338CA', // Primary color on hover
backgroundColor: '#ffffff', // Background color
surfaceColor: '#f3f4f6', // Surface/card background
textColor: '#1f2937', // Primary text color
textMuted: '#6b7280', // Muted/secondary text
borderColor: '#e5e7eb', // Border color
userBubbleBackground: '#4F46E5', // User message background
userBubbleText: '#ffffff', // User message text
botBubbleBackground: '#f3f4f6', // Bot message background
botBubbleText: '#1f2937', // Bot message text
widgetWidth: '380px', // Widget width
widgetHeight: '520px', // Widget height
bubbleSize: '60px', // Trigger bubble size
borderRadius: '12px', // Border radius
fontFamily: "'Inter', system-ui, sans-serif",
fontSize: '14px',
shadow: '0 4px 20px rgba(0, 0, 0, 0.15)'
}
}
Enable agentic capabilities:
{
agent: {
enabled: true,
confidenceThreshold: 0.8, // Minimum confidence for auto-execution
siteMap: [
{ path: '/products', name: 'Products', description: 'View products' },
{ path: '/contact', name: 'Contact', description: 'Contact us' },
{ path: '/pricing', name: 'Pricing', description: 'View pricing plans' }
],
customActions: {
openModal: async (params) => {
// Custom action handler - open a modal
document.getElementById(params.modalId).showModal();
},
trackEvent: async (params) => {
// Custom analytics tracking
analytics.track(params.eventName, params.data);
}
}
}
}
Configure offline behavior:
{
fallback: {
enabled: true,
message: 'Working in offline mode. Some features may be limited.'
}
}
| Callback | Parameters | Description |
|---|---|---|
onReady | () | Called when widget is ready |
onMessage | (message: ChatMessage) | Called on each message sent/received |
onAction | (action: AgentAction) | Called when an agentic action occurs |
onError | (error: Error) | Called when an error occurs |
onToggle | (isOpen: boolean) | Called when widget opens/closes |
This widget is designed to work seamlessly with the @astermind/cybernetic-chatbot-client for advanced RAG capabilities.
apiUrlThe widget connects to these backend endpoints:
| Endpoint | Method | Description |
|---|---|---|
/api/external/health | GET | Health check, verifies connection |
/api/external/chat | POST | Non-streaming chat endpoint |
/api/external/chat/stream | POST | Streaming chat endpoint (SSE) |
data: {"type": "chunk", "content": "Hello"}
data: {"type": "chunk", "content": " there!"}
data: {"type": "sources", "sources": [{"title": "Doc", "url": "..."}]}
data: {"type": "action", "action": {"type": "navigate", "path": "/products"}}
data: {"type": "done", "sessionId": "sess_xxx"}
data: {"type": "error", "error": "Error message"}
When offline or disconnected:
@astermind/cybernetic-chatbot-client is installed with local RAG enabled, queries can still be processed locallyOverride CSS variables in your stylesheet for quick customization:
:root {
/* Colors */
--astermind-primary: #10B981;
--astermind-primary-hover: #059669;
--astermind-background: #ffffff;
--astermind-surface: #f3f4f6;
--astermind-text: #1f2937;
--astermind-text-muted: #6b7280;
--astermind-border: #e5e7eb;
/* User messages */
--astermind-user-bubble-bg: #10B981;
--astermind-user-bubble-text: #ffffff;
/* Bot messages */
--astermind-bot-bubble-bg: #f3f4f6;
--astermind-bot-bubble-text: #1f2937;
/* Dimensions */
--astermind-widget-width: 400px;
--astermind-widget-height: 600px;
--astermind-bubble-size: 64px;
/* Effects */
--astermind-border-radius: 16px;
--astermind-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
/* Typography */
--astermind-font-family: 'Inter', system-ui, sans-serif;
--astermind-font-size: 14px;
}
All elements use the astermind- prefix for easy targeting:
| Class | Element |
|---|---|
.astermind-chatbot | Main container |
.astermind-bubble | Floating trigger button |
.astermind-window | Chat window |
.astermind-header | Window header |
.astermind-messages | Message list container |
.astermind-message | Individual message |
.astermind-message--user | User message modifier |
.astermind-message--bot | Bot message modifier |
.astermind-input | Input area |
.astermind-status | Status indicator |
.astermind-action-card | Action confirmation card |
.astermind-sources | Source citations container |
Direct API client access for custom implementations:
import { useOmega } from '@astermind/chatbot-template';
function MyComponent() {
const {
sendMessage, // Send a message (non-streaming)
sendMessageStream, // Send a message (streaming)
connectionStatus, // 'online' | 'offline' | 'connecting' | 'error'
isProcessing, // Whether a request is in progress
lastError, // Last error that occurred
sessionId, // Current session ID
clearSession // Clear the current session
} = useOmega({
apiUrl: 'https://api.example.com',
apiKey: 'am_your-api-key'
});
const handleSend = async () => {
const response = await sendMessage('Hello!');
console.log(response.reply, response.sources);
};
const handleStreamingSend = () => {
sendMessageStream('Tell me about...', {
onChunk: (chunk) => console.log('Chunk:', chunk),
onSources: (sources) => console.log('Sources:', sources),
onDone: (sessionId) => console.log('Done:', sessionId),
onError: (error) => console.error('Error:', error)
});
};
}
Chat state management:
import { useChat } from '@astermind/chatbot-template';
function MyComponent() {
const {
messages, // Array of chat messages
addMessage, // Add a new message
updateMessage, // Update an existing message
clearMessages, // Clear all messages
pendingAction, // Currently pending agent action
setPendingAction // Set pending action
} = useChat();
}
Theme customization hook:
import { useTheme } from '@astermind/chatbot-template';
function MyComponent() {
const { theme, cssVariables } = useTheme({
primaryColor: '#10B981',
borderRadius: '16px'
});
// cssVariables contains the CSS custom property declarations
return <div style={cssVariables}>...</div>;
}
Auto-scroll behavior for message lists:
import { useScrollToBottom } from '@astermind/chatbot-template';
function MessageList({ messages }) {
const { containerRef, scrollToBottom } = useScrollToBottom();
return (
<div ref={containerRef}>
{messages.map(msg => <Message key={msg.id} {...msg} />)}
</div>
);
}
All components are exported for custom compositions:
import {
ChatbotWidget, // Main widget (includes bubble + window)
ChatBubble, // Floating trigger button
ChatWindow, // Chat window container
ChatHeader, // Window header with title/subtitle
ChatInput, // Message input with send button
MessageList, // Scrollable message container
MessageBubble, // Individual message bubble
ActionCard, // Agentic action confirmation card
SourceCitation, // Source reference component
StatusIndicator, // Connection status display
TypingIndicator // Typing/loading animation
} from '@astermind/chatbot-template';
Build a custom chat interface:
import {
ChatWindow,
ChatHeader,
MessageList,
MessageBubble,
ChatInput,
StatusIndicator
} from '@astermind/chatbot-template';
import '@astermind/chatbot-template/styles';
function CustomChat({ messages, onSend, status }) {
return (
<ChatWindow>
<ChatHeader
title="Support Bot"
subtitle="Always here to help"
/>
<StatusIndicator status={status} />
<MessageList>
{messages.map(msg => (
<MessageBubble
key={msg.id}
content={msg.content}
role={msg.role}
timestamp={msg.timestamp}
/>
))}
</MessageList>
<ChatInput
onSend={onSend}
placeholder="Ask a question..."
/>
</ChatWindow>
);
}
Full TypeScript support with exported types:
import type {
// Configuration
ChatbotConfig,
ThemeConfig,
AgentConfig,
FallbackConfig,
// Messages
ChatMessage,
MessageRole,
// Actions
AgentAction,
ActionType,
NavigateAction,
FormFillAction,
ClickAction,
// Sources
Source,
SourceCitation,
// Status
ConnectionStatus,
// Events
ChatbotCallbacks
} from '@astermind/chatbot-template';
import '@astermind/chatbot-template/styles'apiUrl and apiKey are providedposition: relative or is in the document flowapiUrl is correct and accessible/api/external/chat/stream endpointContent-Type: text/event-stream header is set on responsesagent.enabled is set to trueconfidenceThreshold!important or increase specificity if needed| Browser | Version |
|---|---|
| Chrome | 80+ |
| Firefox | 75+ |
| Safari | 13+ |
| Edge | 80+ |
The standalone bundle includes necessary polyfills for broader compatibility.
| File | Format | Description |
|---|---|---|
astermind-chatbot.esm.js | ESM | ES Module for bundlers (tree-shakeable) |
astermind-chatbot.umd.js | UMD | Universal Module Definition |
astermind-chatbot.min.js | IIFE | Standalone bundle with React included |
astermind-chatbot.css | CSS | Compiled and minified styles |
MIT License - see LICENSE for details.
Built with care by the AsterMind team.
FAQs
Embeddable AI chatbot widget with React support for AsterMind RAG
The npm package @astermind/chatbot-template receives a total of 2 weekly downloads. As such, @astermind/chatbot-template popularity was classified as not popular.
We found that @astermind/chatbot-template demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.

Research
/Security News
Tensorlake npm SDK version 0.5.144 was compromised in a ChainDrop / Shai-Hulud attack, delivering credential-stealing malware.

Research
/Security News
Socket found 16 malicious Firefox extensions designed to steal crypto wallet recovery phrases and private keys using cloned Rabby and OKX interfaces.

Product
Socket now scans VS Code extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.