Skip to content
RSFlowHub
Developer docs API v1 Stable OpenAPI SDKs Playground
Add an AI Chatbot Widget to Your Website

Add an AI Chatbot to Your Website

Create a chatbot in your dashboard, paste one script tag on your site, and visitors can chat with it. No code, no server, no API key in your page.

New to the widget? See the chat widget overview, or add contact forms to the same site.

What the Chat Widget Is

The RSFlowHub Chat Widget is a floating chat window that connects a website to one of your RSFlowHub chatbots. It answers from the knowledge base you attached, can collect visitor details (leads), and lets visitors open a support ticket. You install it with a single <script> tag containing a public widget token. Appearance and behaviour are saved in your dashboard and load automatically, so the code on your site never needs to change.

Install in 4 steps

1

Create a chatbot and add knowledge

Go to Dashboard → Chatbots, create a chatbot, then attach a knowledge base with your FAQs or documents. In support and faq modes the bot only answers from that knowledge, so add content before you go live.

2

Customize it in the Widget tab

Open the chatbot's Widget tab (or click Chat Widget in the sidebar). Set title, brand color, greeting, quick replies and more, and watch the live preview update.

3

Copy the install code

The Install on your website box shows your personal code. It looks like this:

install-snippet.html HTML
<script src="https://rsflowhub.com/widget/v1/rsflowhub-widget.js"
        data-widget-token="wt_sec_YOUR_WIDGET_TOKEN"
        async></script>
4

Paste it before </body>

Add it once, on every page where the chat should appear. Pick your platform:

index.html
<body>
  <!-- your page -->

  <script src="https://rsflowhub.com/widget/v1/rsflowhub-widget.js"
        data-widget-token="wt_sec_YOUR_WIDGET_TOKEN"
        async></script>
</body>
<?php // Appearance > Theme File Editor > footer.php, just before wp_footer() or </body>.
// Or paste the script tag into a plugin such as "WPCode" / "Insert Headers and Footers" (Footer section).
?>
<script src="https://rsflowhub.com/widget/v1/rsflowhub-widget.js"
        data-widget-token="wt_sec_YOUR_WIDGET_TOKEN"
        async></script>
{% comment %} Online Store > Themes > Edit code > layout/theme.liquid, just before </body> {% endcomment %}
<script src="https://rsflowhub.com/widget/v1/rsflowhub-widget.js"
        data-widget-token="wt_sec_YOUR_WIDGET_TOKEN"
        async></script>
// Easiest: paste the script tag into public/index.html before </body>.
// Or load it from a component:
import { useEffect } from 'react';

export default function ChatWidget() {
  useEffect(() => {
    const s = document.createElement('script');
    s.src = 'https://rsflowhub.com/widget/v1/rsflowhub-widget.js';
    s.async = true;
    s.dataset.widgetToken = 'wt_sec_YOUR_WIDGET_TOKEN';
    document.body.appendChild(s);
    return () => s.remove();
  }, []);
  return null;
}
import Script from 'next/script';

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script
          src="https://rsflowhub.com/widget/v1/rsflowhub-widget.js"
          data-widget-token="wt_sec_YOUR_WIDGET_TOKEN"
          strategy="afterInteractive"
        />
      </body>
    </html>
  );
}
{{-- Just before </body> in your main layout --}}
<script src="https://rsflowhub.com/widget/v1/rsflowhub-widget.js"
        data-widget-token="wt_sec_YOUR_WIDGET_TOKEN"
        async></script>
Your widget token is public, your API key is not
The wt_sec_… token only lets visitors chat with that one chatbot and is meant to appear in your page source. Never put your private API key in website code. To limit where the token works, use Allowed websites below.

Settings you control from the dashboard

Changes appear on your site the next time a page loads. No re-install needed.

SettingWhat it does
Title, subtitle, avatarHeader text and logo (avatar must be an https image URL).
Brand color, theme, positionAccent color, light or dark theme, bottom-right or bottom-left.
Launcher labelOptional text next to the chat button, for example "Chat with us".
Greeting & quick repliesFirst message plus up to 4 one-tap suggestions.
Collect visitor detailsAsk for contact details before the chat starts: name + mobile number, name + email, or all three. Mobile numbers are checked (10-digit Indian numbers, or any number with its country code). Saved as leads, with a WhatsApp link next to each mobile number.
WhatsAppAdd your WhatsApp number and visitors get a Chat on WhatsApp link in the chat header, the menu and next to Talk to Human (you choose where). It opens WhatsApp with your number and an optional pre-filled message. Your WhatsApp account is not connected and nothing is sent automatically. The number is visible to visitors.
Human handoffShows Talk to Human. On Starter and above it asks your team to join the chat (and emails you) while still offering a support ticket form; on Free it opens the ticket form. See Reply to visitors live.
Attention bubble, auto-openA small message above the button after a delay, or opening the chat automatically after N seconds.
Allowed websitesRestrict the widget to your own domains (see below).
Daily message limitMaximum visitor messages per day (default 1,000, 0 = no limit). Protects your credits from traffic spikes; you are emailed at 80% and when it is reached.
Privacy & visitor dataHow long to keep visitor data, a notice (and privacy-policy link) under the message box, and an optional consent checkbox on the details and ticket forms.
Email alertsGet an email when a visitor leaves their details or opens a support ticket, optionally to a different address (replying to a ticket email answers the visitor).

Reply to visitors live

On the Starter plan and above you can take any website chat over from the AI and answer the visitor yourself. Open the chatbot's Conversations tab in your dashboard, pick a chat and write a reply (or press Take over). The visitor sees your reply in the chat within a few seconds, under your first name.

  • While a person has the chat, the AI does not answer it and no credits are used.
  • Hand back to AI returns the chat to the bot. If nobody on your team writes for 2 hours, it goes back to the AI by itself, so a visitor is never left without an answer.
  • When a visitor presses Talk to Human, the chat shows Wants a person under the Live filter and you get an email (it follows the support ticket email setting). The visitor can still leave a ticket if they cannot wait.
  • The account owner and team members with the admin role can reply. Other roles can read chats but not reply.
  • On the Free plan, Talk to Human opens the ticket form only.
Nothing to install
Live replies are part of the same script tag. There is no extra code and no setting to switch on: they work as soon as your plan includes them.

Want live prices, stock or order status in the chat? See Live data from your API.

Restrict it to your domains

In Security & domains list one domain per line. example.com also covers www.example.com; use *.example.com to allow every subdomain. Requests from any other website get 403 Origin not allowed.

Leave the list empty to allow any website
With no domains listed the widget works anywhere the token is used. When you do set a list, requests that carry no Origin or Referer header (for example scripts or curl) are rejected too.

JavaScript API (optional)

The script exposes a small global object, RSFlowHubChatbot, so your own buttons or pages can control the chat. You can call it right away: if the chat has not been downloaded yet, calls such as open() download it first and then run. The rsflowhub:ready event fires once the chat button is on the page, and rsflowhub:chat-loaded once the full chat has loaded.

widget-api.js JavaScript
// Run after the widget has started
window.addEventListener('rsflowhub:ready', () => {
  document.querySelector('#help-button').addEventListener('click', () => {
    RSFlowHubChatbot.open();
  });
});

RSFlowHubChatbot.close();            // minimise the chat
RSFlowHubChatbot.toggle();           // open / close
RSFlowHubChatbot.toggleFullscreen(); // expand / shrink
RSFlowHubChatbot.reset();            // clear the conversation

Advanced: override a setting in the page

Attributes on the script tag win over the dashboard value, which is handy for per-page variations.

AttributeEffect
data-widget-tokenRequired. Your public widget token.
data-api-endpointAPI base URL. Defaults to the host the script was loaded from plus /api/v1.
data-title, data-subtitle, data-greetingOverride texts.
data-primary-color, data-theme, data-positionOverride look and placement.
data-lead-capturenone or prechat.
data-auto-open-delaySeconds before the chat opens by itself (0 = never).

Credits, limits and privacy

  • Credits: each reply is billed to the chatbot owner at the same rates as the Chatbot API. Greetings and answers found directly in your FAQ cost little or nothing. See Rate Limits & Credits.
  • When credits run out (or your monthly spending limit is reached) visitors see "This assistant is temporarily unavailable". They never see billing details.
  • Visitor limits: messages up to 2,000 characters, 100 messages per conversation, and about 20 messages per minute per visitor IP. Lead and ticket forms are limited to a few submissions per minute.
  • Daily limit: once your daily message limit is used up, visitors see "We've reached today's chat limit" until the next day (server time). The counter and your 80% / limit-reached emails reset every day.
  • Email volume: lead and ticket emails are capped at 10 per hour per chatbot to protect your inbox. Everything is still saved in the dashboard.
  • Isolation: the chat renders inside a Shadow DOM, so your site's CSS (resets, Bootstrap/Tailwind, global button or div rules, even !important ones) cannot restyle or hide it, and the widget's CSS cannot affect your page.
  • Speed: the file your pages load is a tiny loader (about 4 KB gzipped) that only draws the chat button. The chat itself (about 15 KB gzipped) is downloaded the first time a visitor points at, taps or opens the button, so pages where nobody chats pay almost nothing. Styles are bundled in: no extra stylesheet request.
  • Accessibility: the chat is a labelled dialog that works with a keyboard and screen readers (new messages are announced, Esc closes it and returns focus to the chat button), respects "reduce motion", and automatically picks light or dark text so any brand color stays readable.
  • Script updates: we improve the widget script under the same URL, and browsers refresh it about once an hour. RSFlowHubChatbot.version tells you which version a page is running.
  • Browser storage: the widget keeps the conversation id (24 hours), whether the lead form was completed, whether the attention bubble was dismissed, and a cached copy of your widget settings in the visitor's localStorage. No cookies are set.

Privacy and your visitors' data

You decide what your visitors are told and how long their data is kept. You remain responsible for your own privacy policy and legal basis; these are the tools to support it.

  • What is stored: the chat messages, the details a visitor types into the details form (name, email, phone/company), support tickets, and the time they ticked the consent box. IP addresses are used only for short-lived rate limiting and are not saved with conversations. In your browser's localStorage the widget keeps only the conversation id, whether the form was completed and a cached copy of your widget settings; no cookies are set.
  • AI processing: messages are processed by AI providers to write replies. Use the notice under the message box to say so, for example “Replies are generated by AI. Chats are kept for 90 days.”, and link your privacy policy.
  • Consent checkbox: switch on Require a consent checkbox and the details and ticket forms cannot be sent without it. The time of consent is stored with the lead or ticket.
  • Retention: choose 30, 90, 180 or 365 days (or “until I delete it”). Every night older chat conversations, leads and resolved or closed tickets are deleted automatically. Open tickets are kept. Conversations you started yourself in the dashboard test chat are never deleted automatically.
  • Access and erasure requests: open the chatbot's Leads tab, enter the visitor's email under Privacy requests, then Download their data (a JSON file with their leads, tickets and chats) or Erase their data (permanent). You can also delete a single lead or ticket with the trash icon. Chats are linked to a visitor only when they left their details or opened a ticket in that chat; other chats are removed by the retention setting.

Troubleshooting

SymptomLikely cause and fix
The button appears but clicking it does nothingThe second file, rsflowhub-widget-chat.js, did not load. The console says "Chat could not be loaded". Check the browser's network tab for that file (ad blocker, Content-Security-Policy, or the file was not uploaded next to rsflowhub-widget.js), then click again: it retries.
No chat button appearsOpen the browser console. "missing data-widget-token" means the attribute is absent. Also check that an ad blocker, a Content-Security-Policy or your cache plugin isn't blocking the script, and that the tag is on the page.
401 Invalid Widget Token or inactive chatbotThe token was regenerated, mistyped, or the chatbot's status is inactive. Copy the current code from the Widget tab.
403 Origin not allowedThe site's domain isn't in Allowed websites. Add it (and the www or subdomain variant if needed), or clear the list.
429 "Too many requests"The visitor is sending messages too quickly. It clears after a minute.
"We've reached today's chat limit"The daily message limit in the Widget tab is used up. Raise it (or set 0 for no limit); it also resets automatically tomorrow.
"Temporarily unavailable" replyOut of credits, monthly spending limit reached, or the AI provider is down. Check Billing.
Chat opens but settings look defaultThe settings request failed and no cached copy exists yet (for example a blocked domain). Fix the error above and reload.
My changes don't showSettings load on each page view. Hard-refresh the page and clear any page cache or CDN in front of your site (the script and settings are fetched separately).
Using a Content-Security-Policy?
Allow this host in script-src (the loader and the chat file) and connect-src (API calls): rsflowhub.com. The widget needs no inline script or inline style and no extra stylesheet. Very old browsers (Safari before 16.4) cannot adopt a constructed stylesheet and fall back to an inline <style>, which a strict style-src blocks.

Chat Widget Q&A

No. Create a chatbot in your dashboard, open its Widget tab, copy the one-line script tag and paste it before the closing body tag of your site. Colors, greeting, quick replies and other options are set in the dashboard and load automatically.

No. The widget fetches its settings from RSFlowHub each time a page loads, so saved changes appear on your website the next time a visitor loads the page. You only change the code if you regenerate the widget token.

Yes. The widget token (wt_sec_...) is public by design and is not your API key. It can only chat with that one chatbot, and you can restrict it to your own domains in the Widget tab. Never put your private API key in website code.

Each reply uses credits from the chatbot owner's wallet at the same rates as the Chatbot API. Visitors never see billing details; if credits run out or the monthly spending limit is reached they see a short "temporarily unavailable" message.

Leads captured by the pre-chat form and tickets created from Talk to Human appear in the Leads and Tickets tabs of the chatbot in your dashboard, linked to the conversation they came from. Mobile numbers have a one-tap WhatsApp link. Leads can be exported as CSV.

Yes, on the Starter plan and above. Open the chatbot's Conversations tab, pick a chat and write a reply or press Take over. The visitor sees your reply in the chat within a few seconds, the AI pauses for that chat and no credits are used. Hand back to AI returns it to the bot, which also happens by itself after 2 hours without a reply from your team. The account owner and admins can reply.

Open the chatbot's Widget tab, enter your WhatsApp number (a 10-digit Indian mobile or any number with its country code) and an optional ready message, and choose where the button shows: the chat header, the menu, or next to Talk to Human. Save, and it appears on your site on the next page load. It opens WhatsApp with your number; your WhatsApp account is not connected.

Yes. Under Details to ask for, choose name + mobile number, name + email, or all three. The number is checked in the widget and on the server and saved as +91XXXXXXXXXX (or with its own country code), so one visitor does not become two leads.

Ready to build?

Create your free account and make your first API call in minutes.

RSFlowHub

Sign in to continue

You'll come straight back to this page.

Forgot password?

New to RSFlowHub? Create a free account