An AI chatbot for your website: how to do it right
A chatbot that makes up a price does more harm than a site with no chatbot at all. The one that works answers only with what you wrote and knows when to hand over to a person. Here are content, instructions, key security, legal duties and the test before going live.

On this page
In 30 seconds
- A good chatbot answers from what you know (pages, price lists, FAQs) and says where the answer comes from.
- The technical part is the easiest; the real work is content, instructions and testing.
- The AI service key stays on the server, never in the page’s code.
- The chatbot must say it is an AI (AI Act, Art. 50, from 2 August 2026) and the privacy notice must say where the data goes.
If you already know what a chatbot can do, skip to “The choices to make”.
A customer opens your site at eleven at night and wants to know whether you offer a certain service, how long it takes and how to book. If they find the answer, they book; if they have to dig through five pages, they leave. An assistant on the site does exactly this job, provided it answers only with what you wrote and knows how to say “for this it’s better to talk to a person”.
What it can do, and what not
It can answer frequent questions, explain services and terms, lead to the right page, collect a contact request, help with bookings. It must not give personalised professional advice, promise what isn’t in your documents, ask for sensitive data or invent prices.
How this site’s assistant works
I use it as an example because you can try it on this page, with the “Ask AI” button:
- It knows the site. When the site is published, all pages are split into sections and indexed. For each question the assistant searches the relevant passages and answers from those: the technique explained in the lesson on RAG and semantic search.
- Limited external sources. For data that changes every day it can consult a few chosen sites, not the whole web.
- A fast model. An assistant doesn’t need the most powerful model: what matters is sufficient quality, speed and cost.
- A small server. A function receives the question, adds the instructions, calls the model and streams the answer. The key stays there.
- Clear rules. It introduces itself as AI, points to pages, doesn’t ask for personal data, refers specific cases to me.
The choices to make
Content: where you win or lose
Before any technology:
- write a real FAQ page, with the questions you actually receive (you’ll find them in the emails and messages of recent months);
- keep prices and opening hours in one up-to-date place;
- remove old information from the site: the chatbot would use it.
The model
For simple questions and high volumes, small fast models are enough; for detailed answers or long documents, a mid-range model. A typical answer costs from a fraction of a cent to a few cents: you can estimate with the calculator.
The instructions
A few lines that tell the chatbot who it is, what it answers about, what it must not do, when to hand over to a person and how to cite the source. They must be written carefully and tested on real questions.
Help me write the instructions for the assistant on the website of [business]. It must: introduce itself as an AI assistant; answer only with information from the site’s pages and say which page the answer comes from; say “I don’t know, let me put you in touch with [person or form]” when the information isn’t there; not give personalised [legal / medical / tax] advice; not ask for sensitive data; not promise prices, discounts or dates not written on the site. Tone: [friendly and brief]. Write the instructions in under 200 words, then suggest five questions to test them.
Security: three non-negotiable rules
- Key on the server. If the key is in the page’s code, anyone can copy it and use it at your expense. It goes in the server function’s protected settings.
- Limits. A monthly spending cap, a message limit per user, a maximum question length.
- Distrust of inputs. Someone will try to make it say strange things (“ignore your instructions and…”). Clear instructions, no access to dangerous tools (no sending emails or databases without checks) and tests before publishing. The list of typical risks is in OWASP’s Top 10 for applications built on language models.
Legal obligations
- Transparency (AI Act, Art. 50): whoever chats must know they’re talking to an AI. A clear welcome message and a fixed note under the text field are enough.
- Privacy (GDPR): the notice explains which data goes to the model provider, how long it’s kept and on what basis. Better not to store conversations, or only anonymously.
- Professionals in Italy: if the chatbot belongs to a professional practice, Italian law 132/2025 also requires informing clients about the use of AI. More in the lesson on the AI Act and Italian law.
Before publishing: the test
Prepare about thirty real questions, including hard ones and trick ones (off-topic, provocative, with personal data). Check that the chatbot answers correctly, cites the source, says “I don’t know” when needed and doesn’t break its rules. Repeat the test after every important change.
Prepare 30 questions to test the assistant on the website of [business], split into: 15 normal questions a customer would ask; 5 questions whose answer isn’t on the site; 5 off-topic or provocative questions; 5 attempts to make it ignore its instructions or reveal confidential data. For each group, write what a good assistant should answer.
Mistakes to avoid
- Starting from the model instead of the content. With old FAQs and scattered prices, no model answers well.
- A chatbot that can’t say “I don’t know”. That’s the one that invents.
- Connecting it to tools without checks. Reading is fine; sending or changing data needs approvals.
- Publishing without tests and without a notice. They’re the two things people notice first, in the worst way.
Try it in 10 minutes
Open your inbox for the last three months and copy the ten questions customers ask you most. For each, look for the answer on your site: is it there, up to date, findable in under a minute? The missing ones are the first thing to write, chatbot or not.
In one lineA good chatbot knows a few things, says where they come from and knows when to hand over to a person.
Sources
Informational content. Prices, models and rules change often: check official sources before deciding. Written with the support of AI tools.

