Everything you need to seamlessly integrate SiteBot into your application. Browse our guides, API references, and configuration options.
After creating a chatbot on SiteBot, you receive a unique namespace. Add one script tag to your HTML and the widget loads automatically.
data-namespace in the tag. Config is fetched from the server. Dashboard changes take effect instantly. Best for SPAs and frameworks (React, Next.js, Vite, Vue).data-* attribute to the tag. Those values are locked and never overwritten by the server. Best for static HTML sites, WordPress, and hardcoded pages where you control the embed snippet directly.No environment variables required. The namespace is the only value you need — pass it directly in the script tag or as a prop in your framework component.
<script
src="https://sitebot.online/embed.js"
data-namespace="YOUR_NAMESPACE"
></script>In dynamic mode, the only value you set in the embed snippet is data-namespace. Every other config value (title, colors, icon, shape, welcome message) is fetched from the server at load time. Changes you make in the SiteBot dashboard are reflected instantly — no redeploy needed.
<script
src="https://sitebot.online/embed.js"
data-namespace="YOUR_NAMESPACE"
></script>Key rule: If you add data-title="Support" to the tag, the dashboard title is ignored for that attribute. Only data-namespace should be present for full dynamic behavior.
In static mode, you add data-* attributes directly to the script tag. These values are locked — the server fetch still happens, but any key that is already present on the tag is never overwritten.
<script
src="https://sitebot.online/embed.js"
data-namespace="YOUR_NAMESPACE"
data-title="Support Assistant"
data-welcome="Hi! How can I help you today?"
data-position="right"
data-shape="circle"
data-primary-color="#fa5d19"
data-header-bg="#1e293b"
data-bot-bg="#f3f4f6"
data-user-bg="#fa5d19"
></script>You can mix both approaches. Set only the attributes you want to lock; the rest come from the server. For example, lock the title and primary color but let the dashboard control everything else:
<script
src="https://sitebot.online/embed.js"
data-namespace="YOUR_NAMESPACE"
data-title="Always This Title"
data-primary-color="#fa5d19"
></script>In React, use a useEffect hook to create the script element dynamically. This avoids next/script quirks with data-* attributes.
Only set dataset.namespace. All other config comes from the server.
'use client';
import { useEffect } from "react";
export function ChatWidget() {
useEffect(() => {
const s = document.createElement("script");
s.src = "https://sitebot.online/embed.js";
s.dataset.namespace = "YOUR_NAMESPACE";
document.body.appendChild(s);
}, []);
return null;
}Set any dataset.* property to lock that value. Use camelCase: data-header-bg becomes dataset.headerBg.
'use client';
import { useEffect } from "react";
export function ChatWidget() {
useEffect(() => {
const s = document.createElement("script");
s.src = "https://sitebot.online/embed.js";
s.dataset.namespace = "YOUR_NAMESPACE";
s.dataset.title = "Support";
s.dataset.position = "right";
s.dataset.shape = "circle";
s.dataset.primaryColor = "#fa5d19";
s.dataset.headerBg = "#1e293b";
document.body.appendChild(s);
}, []);
return null;
}Use in your app: <ChatWidget /> in any page or layout.
In a Vite project (Vue, React, or vanilla JS), you have two options: add the script tag directly to index.html, or load it dynamically from a component.
Vite injects index.html as the entry point. Add the script tag there — same as the plain HTML approach above.
<!-- dynamic mode: only namespace -->
<script
src="https://sitebot.online/embed.js"
data-namespace="YOUR_NAMESPACE"
></script>If you need the widget to load conditionally or with runtime values, create the script element in a component:
// React
import { useEffect } from "react";
export function ChatWidget({ namespace }: { namespace: string }) {
useEffect(() => {
const s = document.createElement("script");
s.src = "https://sitebot.online/embed.js";
s.dataset.namespace = namespace;
document.body.appendChild(s);
}, [namespace]);
return null;
}
// Vue — same idea in onMounted():
// const s = document.createElement("script");
// s.src = "https://sitebot.online/embed.js";
// s.dataset.namespace = props.namespace;
// document.body.appendChild(s);For static mode, add s.dataset.title = "..." etc. before appending.
In Next.js, use a client component with useEffect. Do not use next/script — it does not reliably set data-* attributes on the DOM element.
"use client";
import { useEffect } from "react";
export function ChatWidget() {
useEffect(() => {
const s = document.createElement("script");
s.src = "https://sitebot.online/embed.js";
s.dataset.namespace = "YOUR_NAMESPACE";
document.body.appendChild(s);
}, []);
return null;
}Add to your root layout:
import { ChatWidget } from "@/components/ChatWidget";
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<ChatWidget />
</body>
</html>
);
}'use client';
import { useEffect } from "react";
export function ChatWidget() {
useEffect(() => {
const s = document.createElement("script");
s.src = "https://sitebot.online/embed.js";
s.dataset.namespace = "YOUR_NAMESPACE";
s.dataset.title = "Support";
s.dataset.position = "right";
s.dataset.shape = "circle";
s.dataset.primaryColor = "#fa5d19";
s.dataset.headerBg = "#1e293b";
document.body.appendChild(s);
}, []);
return null;
}Why not next/script? The Next.js Script component does not reliably pass data-* attributes to the DOM. document.createElement + dataset.* is the only reliable approach.
All options are set as data- attributes on the script tag. In React/Vue/Next.js, use dataset.* (camelCase). The attribute name maps by removing data- and converting kebab-case to camelCase.
| Attribute | Default | Description |
|---|---|---|
| data-namespace | — | Your chatbot namespace (required)(required) |
| data-title | Chat Assistant | Header title |
| data-welcome | Hi there! Ask me anything. | Welcome message |
| data-position | right | left or right |
| data-shape | circle | circle or square |
| data-placeholder | Type your message... | Input placeholder text |
| data-icon | — | Custom icon image URL for the bubble |
| data-theme | auto | auto, light, or dark |
| data-quick-prompts | — | Newline-separated list of quick prompt suggestions |
| data-escalation | false | Enable human escalation toggle |
| data-api-url | (auto-derived) | API base URL (auto-derived from script src) |
| data-width | 380 | Panel width in px |
| data-height | 500 | Panel height in px |
| data-bubble-size | 60 | Bubble diameter in px |
| data-offset-bottom | 24 | Bubble distance from bottom in px |
| data-offset-side | 24 | Bubble distance from side in px |
| Attribute | Default | Description |
|---|---|---|
| data-lead-title | Please enter your details | Title for the lead capture form |
| data-lead-name-label | Name | Label for the name field |
| data-lead-email-label | Label for the email field | |
| data-lead-phone-label | Phone | Label for the phone field |
| data-lead-submit-label | Submit | Label for the submit button |
| data-lead-success-msg | Thank you! | Success message after submission |
| Attribute | Default | Description |
|---|---|---|
| data-border-radius | auto | Panel border radius |
| data-panel-border-color | — | Panel border color |
| data-msg-gap | — | Gap between messages |
| data-msg-font-size | — | Message font size |
| data-msg-max-width | — | Max width of message bubbles |
| data-font-family | — | Custom font family |
| data-custom-css | — | Custom CSS injected into the widget |
| Attribute | Description |
|---|---|
| data-header-bg | Header background |
| data-header-title-color | Header title text color |
| data-header-status-color | Online status text color |
| data-header-avatar-bg | Avatar circle background |
| data-online-text | Online status text |
| data-online-dot-color | Online indicator dot color |
| data-close-btn-color | Close button color |
| Attribute | Description |
|---|---|
| data-bot-bg | Bot message background |
| data-bot-color | Bot message text |
| data-user-bg | User message background |
| data-user-color | User message text |
| data-bg | Chat area background |
| data-text | General text color |
| data-text-secondary | Secondary text color |
| data-typing-bg | Typing indicator background |
| data-typing-dot-color | Typing indicator dot color |
| Attribute | Description |
|---|---|
| data-input-bg | Input field background |
| data-input-text-color | Input text color |
| data-input-border-color | Input border color |
| data-input-placeholder-color | Placeholder text color |
| data-send-bg | Send button background |
| Attribute | Description |
|---|---|
| data-primary-color | Primary brand color (buttons, accents, bubble default) |
| data-bubble-color | Bubble icon color |
| data-welcome-icon-bg | Welcome screen icon background |
| data-welcome-title-color | Welcome screen title color |
| data-welcome-text-color | Welcome screen body text color |
All colors accept any valid CSS color value. Use the attribute names from the tables above. In dataset.* (React/Vue/Next.js), use camelCase — e.g. data-primary-color becomes dataset.primaryColor.
For runtime control, use the globally injected window.SiteBot object. This is useful for single-page applications that need to update config without reloading.
window.SiteBot.configure({
title: "Sales Assistant",
welcome: "Interested in our enterprise plans?",
primaryColor: "#fa5d19",
shape: "circle",
position: "right",
});window.SiteBotConfig can also be set before the embed script loads to inject config at page load time.
<script>
window.SiteBotConfig = {
title: "Locked Title",
primaryColor: "#fa5d19",
};
</script>
<script
src="https://sitebot.online/embed.js"
data-namespace="YOUR_NAMESPACE"
></script>