# How to Add an AI Chatbot to Your Business Website

Turn your existing site into an assistant that answers questions, cites sources, and captures leads.

## Start from content you already have

A business chatbot does not need a written FAQ covering every question. It needs your existing website as a knowledge base: service pages, pricing, policies, contact details. If a page answers a customer question today, the chatbot can answer it tomorrow.

This is the procedure I use. The specifics below match my implementation — Cloudflare Vectorize, D1, streaming responses — but the failure modes apply to any stack.

## Prerequisites

* A website with public pages worth quoting.
* One owner who can decide which pages the assistant may use.
* Three real customer questions to test with.

## Step 1: Crawl and extract

Point the crawler at your site. Bound it: same origin, a page cap, a depth cap, and an exclusion list for admin, cart, and login paths. Strip navigation, footer, and chrome — boilerplate poisons retrieval. What remains is one document per page with its URL attached. Keep the URL. Citations are the product.

Failure mode: JavaScript-rendered pages return empty shells. Verify extraction by reading a sample chunk before indexing anything.

## Step 2: Chunk and embed

Split each page into overlapping passages of a few hundred words. Embed each chunk into a vector and store it with metadata: workspace ID, source ID, document ID. The metadata is load-bearing — it is what keeps one customer's content out of another customer's answers. Every retrieval query must filter on it. Test the filter with fixtures, not by inspection.

## Step 3: Retrieve, then generate

At question time, search the vectors scoped to the workspace, take the top passages, and hand them to the model with one instruction: answer strictly from this context. If nothing relevant comes back, do not generate — return a fixed fallback that routes the visitor to contact. The fallback is a feature. It is what makes the bot trustworthy on content it does not have.

## Step 4: Install the widget

Two artifacts: a hosted chat page for sharing, and a small loader script for your site. The loader should be dependency-free and async so it never blocks rendering. It injects a launcher button; the conversation itself runs in an iframe pointed at the hosted page, which keeps your site's styles and scripts isolated from the widget.

## Step 5: Verify before trusting it

Ask your three real questions. Check two things: does the answer match the page, and does the citation link to that page? Then ask something your site does not cover. You should get the fallback, not a guess. If you get a guess, the retrieval filter or the fallback path is broken — fix that before publishing.

## What to look for when choosing one

* Citations on every answer, linking to real pages.
* A visible fallback instead of confident fabrication.
* Workspace-scoped retrieval you can verify, not a promise.
* Lead capture that stores the conversation with the contact.
* Usage metering you can read: what counts as a billable reply, and what does not.

I run this exact loop on [my own business chatbot](/custom-business-chatbot). Enter a URL and test it against your own pages before paying anything.


Last updated on December 1, 2026