← Tous les articles

Adding an AI chatbot to your website: what to decide before you start

An AI assistant on your site can answer visitors' questions at any hour, or confidently make promises you never made. Realistic use cases, where answers come from, off-the-shelf widget or custom build, personal data, costs and ongoing review.

Adding an AI chatbot to your website: what to decide before you start

Key points

  • An AI chatbot is useful when it answers from your own content, and risky when it answers “from memory”.
  • Answer quality depends first on your pages: an assistant can’t explain what your site doesn’t.
  • Before picking a tool, decide who reviews the conversations, where visitor data goes and how the bill is capped.

“Could we put an AI on the site to answer customers?” Since chat assistants went mainstream, the question comes up in almost every scoping meeting we hold. The answer is often yes, though not always in the form people picture. A poorly designed chatbot can tell a visitor that an item is in stock when it isn’t, or invent a warranty or a discount. Done well, it saves time for your visitors and your team alike. These are the questions we put to clients before writing a single line of code.

What an AI chatbot does well, and what it does badly

Language models are very good at rephrasing, summarising and finding information in text, even when the question is vague or full of typos. They’re bad at anything that needs an exact, current fact nobody gave them. On our projects, the uses that work all look alike:

  • answering common questions from your FAQ, terms of sale, service pages or product documentation;
  • pointing visitors to the right page, form or person;
  • helping someone choose between a handful of offers by asking two or three questions, based on criteria you’ve written down;
  • pre-qualifying a quote request and handing your sales team a structured summary.

What works badly: personalised pricing, confirming availability, delivery times or order status without a connection to your systems, handling a sensitive complaint, or giving legal or medical advice. For those, the right move is for the chatbot to hand over to a human, and that hand-over has to be designed in.

A simple test: if a good share of the questions your team gets by email and phone already have an answer on your site, an assistant can absorb them. If every request is a special case, it will mostly make customers wait.

Where the answers come from: your content, not “the internet”

This is the most important question, and the one sales demos tend to skip. Asked as-is, a language model doesn’t know your prices, opening hours or terms, and when it doesn’t know, it tends to produce a plausible answer rather than admit it.

The approach that has become standard is called RAG (retrieval-augmented generation). For each question, you first search your own content for relevant passages, then pass them to the model with instructions to answer from those passages only. Here’s a deliberately simplified version of that first step on a WordPress site:

<?php
// Server side: find the passages of YOUR content that relate to the question
function context_for_question( string $question ): string {
    $q = new WP_Query( [
        's'              => $question,
        'post_type'      => [ 'page', 'post' ],
        'post_status'    => 'publish',
        'posts_per_page' => 4,
        'no_found_rows'  => true,
    ] );

    $excerpts = [];
    foreach ( $q->posts as $p ) {
        $excerpts[] = '### ' . get_the_title( $p ) . ' (' . get_permalink( $p ) . ")n"
                    . wp_trim_words( wp_strip_all_tags( $p->post_content ), 250 );
    }
    return implode( "nn", $excerpts );
}

WordPress’s built-in search is keyword-based and struggles with rephrasing. In production we use semantic, vector-based search (embeddings) instead, which finds a passage about “shipping fees” when a visitor asks “how much is delivery”. The principle is the same. Next comes the instruction sent to the model alongside those excerpts:

You are the assistant for this company's website. Answer only from
the excerpts provided below. If the answer isn't there, say so plainly and
point to the contact form. Never state a price, timeframe or commitment that
doesn't appear in the excerpts. End with a link to the page the information
came from.

EXCERPTS:
{context}

VISITOR QUESTION:
{question}

Instructions like these cut down invented answers a lot, but not completely, which is why reviewing conversations (see below) isn’t optional. They also have a direct consequence for you: if the information isn’t written anywhere on your site, the assistant can’t give it. On several projects, step one was writing a proper FAQ and updating out-of-date service pages. That’s often the most lasting benefit of the whole exercise, chatbot or not.

Off-the-shelf widget or custom integration

Plenty of services offer a chatbot you install by pasting a script: give them your site’s address, they index the pages, and the assistant goes live the same day. For testing the idea, that’s a great option.

The limits show once you want more: no access to your internal data (stock, orders, customer accounts), little control over which pages are indexed or over the instructions, conversations stored with a third party, and a subscription that grows with message volume. A custom integration, with processing on your own server, lets you:

  • choose exactly which content is used, and exclude what shouldn’t be;
  • connect the assistant to your systems, with the same access controls as the rest of the site;
  • keep the API key on the server and control where data travels;
  • switch model providers without starting over.

What we usually recommend: start with an existing tool on a limited part of the site for a few weeks, look at the questions people actually ask, then decide whether a custom build is justified. Real conversations make the best starting point for a specification.

Personal data, security and keeping costs under control

A chatbot takes free text, and visitors type whatever they like into it: order numbers, addresses, sometimes health or banking details. Several things need settling from day one:

  • Telling visitors: make it clear they’re talking to an AI, what is kept and for how long, and update your privacy policy.
  • Processors: the model provider, and the widget vendor if there is one, handle personal data. Check their terms (data location, reuse for training, retention) and document them as you would for any processor under GDPR.
  • API key: it must never sit in browser-side JavaScript. Calls go through your server, the only place that knows the key.
  • Abuse: an open chat box is a target. Limit messages per visitor per minute and question length, and set a spending cap with the model provider.
  • Manipulation: some visitors will try to make the assistant say anything at all. Give it access only to public data or the logged-in user’s own data, and never to irreversible actions without confirmation.

On budget, an assistant’s cost has three parts: setup, usage-based billing for the model (proportional to the amount of text processed, so to traffic and to the size of the excerpts you send), and the time spent reviewing and improving it. That last one is the one most often left out of estimates, yet it’s what determines the quality of the result.

Measure, fix, maintain

A chatbot isn’t something you deliver and forget. On the assistants we maintain, we regularly review a sample of conversations, especially those where the visitor rephrased several times or ended up asking for a human. Each bad answer usually has one of three causes: the information is missing from the site, the right passage wasn’t found, or the instructions are ambiguous. The fix goes in the right place: on the page, in the indexing, or in the instructions.

When prices or terms change, the index has to be rebuilt; on WordPress we trigger that automatically when a relevant page is saved. And decide up front what you’ll track (conversations resolved without hand-over, contact requests, unanswered questions), or nobody will be able to say whether the assistant is helping.

FAQ

Can an AI chatbot replace our customer service?

No, and that’s not the goal. It absorbs repetitive questions whose answers already exist and prepares the rest for a person. Always provide a clear route to a human.

How do we stop it making things up?

By combining three things: answers grounded only in excerpts from your content, instructions that explicitly allow it to say “I don’t know”, and regular review of conversations. None of these is enough on its own.

Considering an AI assistant for your website or app? We build integrations that answer from your own content, with your data under your control. Let’s talk about your project.

Partager LinkedIn Facebook X WhatsApp
</>

webtestudio

Agence web : sites WordPress sur mesure, thèmes premium et logiciels SaaS.

Parler de votre projet →