Back to all articles
guideshow-to

How to Train an AI Chatbot on Your Website Content (Step by Step)

How to train an AI chatbot on your website content: pick the right pages, crawl or import a sitemap, fill gaps with Q&A, write a system prompt, and test answers.

How to Train an AI Chatbot on Your Website Content (Step by Step)

To train an AI chatbot on your website content, choose the pages that actually answer customer questions, crawl them or import your sitemap, add short Q&A entries for answers that aren't on the site, write a system prompt that sets scope and tone, and test with real questions before going live. Most of the quality comes from the first and last steps, not from the tool.

This guide walks through the process using Elk, but the same method works with any retrieval-based chatbot (often called a RAG chatbot). Retrieval means the bot searches your content for each question and answers from what it finds, instead of relying only on the model's general knowledge.

Paste your URL and build your agent free

Elk crawls your site, trains an AI agent on it, and gives you a chat widget you can test in a few minutes. No credit card required.

https://

How a website-trained chatbot works

A retrieval-based chatbot does four things:

  1. Collects your content by crawling pages, reading a sitemap, or taking uploaded files
  2. Splits that content into short chunks and indexes them for search
  3. Retrieves the most relevant chunks when a visitor asks a question
  4. Answers using a language model, guided by your system prompt and the retrieved chunks

So the agent can only be as good as the content it can find. If your shipping policy is buried in a footer PDF, or exists in three conflicting versions, the bot will struggle the same way a new hire would.

Step 1: Decide what the chatbot should know

Before you crawl anything, list the 20 to 30 questions customers ask most. Pull them from your inbox, live chat history, sales calls, or ask your support team. Then find the page that answers each one.

Group your pages into three buckets:

  • Include: product and service pages, pricing, FAQs, help center articles, shipping and returns, policies, integrations, contact and hours
  • Maybe: blog posts. Include them if they explain how your product works, skip them if they're news or opinion.
  • Exclude: outdated pages, tag and category archives, login pages, duplicate URLs with tracking parameters, and anything you don't want the bot to repeat

If a common question has no page at all, note it. You'll fill it in Step 4.

Step 2: Create your agent

  1. Sign up at elkagent.com. The free Hobby plan is enough to follow this guide.
  2. Enter your website URL during onboarding. Elk fetches basic information about your site and suggests which pages to train on.
  3. Pick an agent type, such as Customer Support or Sales. It sets a starting prompt you can edit later.

Step 3: Add your website content

Open your agent, go to Sources → Website, and choose one of three methods:

MethodUse it when
Crawl DomainYou want Elk to discover pages by following links from your homepage
Individual LinksYou only want a handful of specific pages
SitemapYour site has a sitemap.xml. This is usually the cleanest and most complete option.

After the crawl or sitemap import, Elk shows the list of pages it found. You can select up to 500 pages per scrape. Use the include/exclude list from Step 1 and untick anything that doesn't belong.

Tips for cleaner results:

  • Prefer your sitemap over a crawl if your site has lots of filter or tag URLs
  • If your help center is on a subdomain (such as help.yoursite.com), add it as its own source
  • Pages that load content only through JavaScript after the page loads may come through thin. Check them in Step 6.

Step 4: Fill the gaps with files, Q&A and connectors

Website content rarely covers everything. Add:

  • Files for PDFs, DOCX, PPTX, spreadsheets, CSV or Markdown. Product spec sheets, price lists and policy documents often live here.
  • Q&A for the questions with no page: "Do you ship to Canada?", "Can I pause my subscription?". Keep each answer short and factual.
  • Articles for longer explanations you don't want to publish on the site.
  • Notion, Google Drive or Dropbox if your internal docs live there.

A good Q&A entry looks like this:

Q: Do you offer refunds on annual plans?
A: Yes. Annual plans can be refunded within 14 days of purchase.
   After 14 days, you can cancel and keep access until the end of the
   billing period. Email billing@yourcompany.com to request a refund.

Step 5: Write a system prompt that sets the rules

The system prompt tells the agent who it is, what it should and shouldn't do, and how to sound. Find it in the agent's Playground → AI tab, where you also pick the model and temperature. Here's a starting point to adapt:

You are the support assistant for [Company], which sells [what you sell]
to [who you sell to].

- Answer only using the provided knowledge. If the answer is not in it,
  say you are not sure and offer to connect the customer with the team.
- Keep answers short: 2-4 sentences, then offer a next step or link.
- Never make up prices, discounts, delivery dates, or policies.
- For billing disputes, legal questions, or angry customers, offer to
  hand off to a human.
- Match the customer's language.
- Tone: friendly, plain, no jargon.

Two settings affect answers more than people expect:

  • Model. Start with a fast, low-cost model (1 credit per message in Elk) and only move to a flagship model if answers fall short in testing.
  • Temperature. Keep it low for support so answers stay consistent.

Step 6: Test before you go live

Use the Playground to chat with your agent, and the Knowledge Playground to see which chunks of content the agent retrieves for a given query.

Run your 20 to 30 real questions from Step 1 and score each answer:

ScoreMeaningFix
CorrectAccurate and completeNothing to do
PartialRight idea, missing detailAdd a Q&A entry or improve the source page
WrongIncorrect or outdatedFind the conflicting source and remove or update it
Refused"I'm not sure" when the answer existsCheck the Knowledge Playground. The page may not be indexed or may be worded differently.

Also test questions the bot shouldn't answer, such as competitor questions, medical or legal advice, or anything off-topic. It should decline politely and offer a next step.

Step 7: Deploy and set up handoff

When the answers hold up:

  1. Go to Integrate → Website Widget and copy the embed snippet into your site, before the closing </body> tag or in your site builder's custom code area.
  2. Customize the widget's colors, welcome message and suggested questions under Playground → Appearance.
  3. Add a handoff path from Plugins. Zendesk Ticket or Intercom Ticket create a ticket for your team. Slack Notify pings a channel when certain topics come up.
  4. Turn on lead collection if you want visitors' names and emails before or during chat. Captured leads appear under Leads.

You can deploy the same agent to WhatsApp, Instagram, Messenger and Slack later from the same Integrate tab. See how to connect an AI agent to WhatsApp.

Step 8: Keep it accurate over time

  • Review conversations weekly in Chats. Look for wrong answers and new question types.
  • Retrain website sources after you change pricing, policies or product pages. Growth plans and above can retrain automatically.
  • Use knowledge gap reports (Growth and above) to see questions the agent couldn't answer, then add Q&A entries for them.
  • Check analytics to see conversation volume and where chats come from.

Common mistakes to avoid

  • Training on everything. More pages isn't better if half of them are outdated. Conflicting sources produce confident wrong answers.
  • Skipping the system prompt. Without clear rules, the agent fills gaps with general knowledge.
  • No handoff path. Customers who can't reach a person get frustrated fast.
  • Setting it and forgetting it. Your site changes, and the agent needs to change with it.

Frequently asked questions

How long does it take to train an AI chatbot on a website?

The crawl and indexing usually take minutes for a typical small-business site. The work that takes longer is choosing which pages to include, adding Q&A for missing answers, and testing. Plan an afternoon for a first version you trust.

Do I need to write code to train a chatbot on my website?

No. With Elk you paste your URL, choose pages from a crawl or sitemap, and the platform handles chunking and indexing. You only need code to embed the widget, which is a single script tag, and even that can be added through most site builders without touching code.

Will the chatbot make things up?

A retrieval-based chatbot answers from the content you give it, which greatly reduces made-up answers, but it does not remove them entirely. A clear system prompt that tells the agent to say it does not know, plus regular review of real conversations, keeps it honest.

How do I keep the chatbot up to date when my website changes?

Retrain the website source after major content changes. In Elk you can retrain any website source on demand from the Sources page, and Growth plans and above can retrain the knowledge base automatically.

Which pages should I leave out?

Leave out pages that are outdated, duplicated across many URLs, purely navigational, or that contain information you do not want repeated, such as old pricing, internal notes, or legal pages that are better linked than paraphrased.

Can I train the chatbot on PDFs and docs that are not on my website?

Yes. Elk accepts files such as PDF, DOCX, PPTX, XLSX, CSV and Markdown, and can connect to Notion, Google Drive and Dropbox, so internal docs, policies and product sheets can sit alongside your website content.

Wrap-up

Training an AI chatbot on your website is mostly an editing job. Pick the pages that answer real questions, fill the gaps with short Q&A, set clear rules in the system prompt, and test with real questions before customers see it. The tool handles the crawling and indexing. Your content decides how good the answers are.

If you're still choosing a platform, compare options in Elk vs Chatbase or check Elk's plans.

Paste your URL and see your trained agent in minutes

Elk crawls your site, trains an AI agent on it, and gives you a chat widget you can test in a few minutes. No credit card required.

https://