Embed an AI-powered chat directly into your website content with the new v2 widget
The v2 widget now supports inline mode, allowing you to embed chat widgets directly into your content. It automatically detects .hai-chat-widget
containers and creates inline widgets, while still supporting floating widgets for traditional use cases.
The widget below reflects your configuration settings. The v2 widget automatically detects the .hai-chat-widget
container and creates an inline widget:
Add the following code to your HTML:
<!-- Add container where you want the chat -->
<div class="hai-chat-widget"></div>
<!-- Add configuration and script -->
<script>
window.chatbotConfig = {
chatbotId: "YOUR_CHATBOT_ID",
chatbotServer: "https://hybridai.one",
welcome_message: "Welcome to our AI assistant! 🤖 Ask me anything about our products or services."
};
</script>
<script src="https://hybridai.one/hai_embed.js"></script>
Parameter | Type | Description | Default |
---|---|---|---|
chatbotId |
string | Your unique chatbot identifier | Required |
chatbotServer |
string | Server URL hosting your chatbot | https://hybridai.one |
welcome_message |
string | Custom welcome message displayed immediately (no backend call) | None |
fontSize |
string | Base font size for chat interface | 14px |
ttsEnabled |
boolean | Enable text-to-speech for bot responses | false |
backgroundColor |
string | Background color of the chat widget | #ffffff |
borderRadius |
string | Border radius for rounded corners | 8px |
boxShadow |
string | Box shadow for depth effect | 0 2px 4px rgba(0,0,0,0.1) |
mode |
string | Widget mode: "auto", "inline", "floating", or "both" | auto |
Perfect for help sections or documentation pages:
<div class="content">
<article>Your main content...</article>
<aside>
<div class="hai-chat-widget"></div>
</aside>
</div>
Display a personalized greeting without backend delay:
<script>
window.chatbotConfig = {
chatbotId: "YOUR_ID",
welcome_message: "Hi! 👋 How can I help?"
};
</script>
Customize appearance and functionality:
<div class="hai-chat-widget"
style="height: 600px;
background: #f0f0f0;
border-radius: 16px;"></div>
<script>
window.chatbotConfig = {
chatbotId: "YOUR_ID",
fontSize: "16px",
ttsEnabled: true
};
</script>
The v2 widget supports different modes to adapt to your needs. Below you can see live examples of each mode in action:
The widget automatically detects if there are .hai-chat-widget
containers in the DOM:
Live Demo (Above)
The main demo widget above uses auto mode and automatically created an inline widget when it detected the container.
// Auto mode - widget detects containers automatically
window.chatbotConfig = {
chatbotId: "YOUR_CHATBOT_ID",
mode: "auto" // This is the default
};
Forces inline widget creation in .hai-chat-widget
containers:
Live Inline Widget:
// Inline mode - forces inline widgets
window.chatbotConfig = {
chatbotId: "YOUR_CHATBOT_ID",
mode: "inline"
};
Creates traditional floating chat button and window:
Floating Widget:
// Floating mode - traditional chat button
window.chatbotConfig = {
chatbotId: "YOUR_CHATBOT_ID",
mode: "floating"
};
Creates both inline and floating widgets simultaneously:
Both Widgets:
Plus floating button in corner
// Both mode - inline + floating widgets
window.chatbotConfig = {
chatbotId: "YOUR_CHATBOT_ID",
mode: "both"
};
/* Set custom dimensions */
.hai-chat-widget {
height: 600px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
/* Responsive height */
@media (max-width: 768px) {
.hai-chat-widget {
height: 400px;
}
}
The widget inherits your site's font family and adapts to your container's width. You can further customize it to match your brand.