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.'use client';
import { useEffect } from "react";
export function ChatWidget() {
useEffect(() => {
const s = document.createElement("script");
s.src = process.env.NEXT_PUBLIC_SITEBOT_SCRIPT_URL || "https://cdn.sitebot.online/embed.js";
s.dataset.namespace = process.env.NEXT_PUBLIC_SITEBOT_NAMESPACE || "your-namespace";
document.body.appendChild(s);
}, []);
return null;
}NEXT_PUBLIC_SITEBOT_SCRIPT_URL=https://cdn.sitebot.online/embed.js
NEXT_PUBLIC_SITEBOT_NAMESPACE=your-namespaceFor production applications, use environment variables to configure the embed script URL and namespace. This keeps secrets out of your source code and allows per-environment configuration.
NEXT_PUBLIC_SITEBOT_SCRIPT_URL=https://cdn.sitebot.online/embed.js
NEXT_PUBLIC_SITEBOT_NAMESPACE=your-namespace'use client';
import { useEffect } from "react";
export function ChatWidget() {
useEffect(() => {
const s = document.createElement("script");
s.src = process.env.NEXT_PUBLIC_SITEBOT_SCRIPT_URL || "https://cdn.sitebot.online/embed.js";
s.dataset.namespace = process.env.NEXT_PUBLIC_SITEBOT_NAMESPACE || "your-namespace";
document.body.appendChild(s);
}, []);
return null;
}Best Practice: Always provide fallback values (as shown above) to handle cases where environment variables are not available.
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>Choose your framework below to see environment-variable based installation. All examples support dynamic mode — configure the namespace and script URL via environment variables.
'use client';
import { useEffect } from "react";
export function ChatWidget() {
useEffect(() => {
const s = document.createElement("script");
s.src = process.env.NEXT_PUBLIC_SITEBOT_SCRIPT_URL || "https://cdn.sitebot.online/embed.js";
s.dataset.namespace = process.env.NEXT_PUBLIC_SITEBOT_NAMESPACE || "your-namespace";
document.body.appendChild(s);
}, []);
return null;
}NEXT_PUBLIC_SITEBOT_SCRIPT_URL=https://cdn.sitebot.online/embed.js
NEXT_PUBLIC_SITEBOT_NAMESPACE=your-namespaceNext.js Note: Use process.env to access environment variables. Do not use next/script — it doesn't reliably set data-* attributes.
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-quick-prompt-bg-color | — | Quick prompt button background color |
| data-quick-prompt-text-color | — | Quick prompt button text color |
| data-quick-prompt-border-color | — | Quick prompt button border color |
| 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>