An AI chatbot for business websites works when it has one narrow job, answers only from content you control, refuses what it should not answer, hands over to a person smoothly, and is measured against real outcomes. Start small, log carefully, and widen the scope only when the data supports it.
This article covers one feature from scoping to rollout. For the overview of whether and where AI fits your site, see where to start with AI features. For the code-level side of calling a model from PHP, see integrating an LLM API into a PHP application.
Decide the job of your AI chatbot for business websites
"Answer customer questions" is not a job description. Pick one or two tasks and write them as testable statements:
- Answer questions about delivery, returns and opening hours using the published policy pages.
- Help a visitor find the right product or service and link to it.
- Collect the details for a quote request and pass them to the sales inbox.
- Deflect repetitive support questions and route the rest to a person.
Also write down what it will not do: take payments, change orders, give legal, medical or financial advice, promise prices or dates. A narrow scope is easier to build, easier to test and much easier to trust. Ask whether a better search box, an FAQ page or a contact form would solve the same problem more cheaply; sometimes it will.
Knowledge sources and freshness
A chatbot that answers from the model's general training will sound confident and be wrong about your business. The usual remedy is retrieval: your system finds the relevant passages from your own content and gives them to the model along with the question, instructing it to answer only from those passages.
Decisions that matter more than the choice of model:
- What is in the knowledge base. Policies, product data, FAQs, service descriptions. Leave out internal documents unless you are certain every visitor may see them.
- Who owns it. Name a person responsible for keeping each source correct. Stale answers about returns or opening hours cause real complaints.
- How it updates. Re-index automatically when a page changes, or on a schedule, and record the date each passage was last refreshed.
- What happens with no match. If nothing relevant is found, the bot should say so and offer a human, not improvise.
Where possible, show the source page next to an answer so the visitor can check it. It also helps your team debug wrong answers.
Guardrails and refusals
Guardrails are a mix of instructions to the model and checks in your own code. Do not rely on instructions alone.
What a chatbot should not answer
- Anything outside the business: general chat, opinions, homework help. A polite redirect is enough.
- Regulated advice such as medical, legal or financial guidance. Point to a qualified professional or your contact page.
- Commitments: prices not in the data, delivery promises, refunds, discounts, contract terms.
- Questions about other customers or internal systems.
Technical safeguards
- Rate limit sessions and cap message length to limit abuse and cost.
- Assume visitors will try to make the bot ignore its instructions. Never put secrets or private data in the prompt, and never give the model tools that can do harm without a separate confirmation step.
- Treat its output as untrusted text: escape it before display, and do not render raw HTML from it.
- Keep a short test list of awkward questions (off-topic, rude, trying to extract the prompt, asking for a discount) and run it before every change.
Also say clearly on the page that visitors are talking to an automated assistant and that answers may contain mistakes.
Human handoff
The handoff is where most of the customer experience is won or lost. Define the triggers: the visitor asks for a person, the bot cannot find an answer twice in a row, the topic is sensitive (complaints, cancellations, safety), or the visitor seems frustrated.
When it triggers, pass along the conversation transcript and any details collected so the customer does not repeat themselves. Decide what happens outside staffed hours: a clear message, a callback or email form, and an expectation of when someone will reply. A bot that promises "a colleague will join shortly" at midnight does more harm than no bot.
Logging and privacy
You need conversation logs to improve the bot, but they may contain personal data that visitors typed in without being asked. Decide up front:
- What you store (messages, timestamps, which sources were used, whether the visitor rated the answer) and for how long.
- Who can read logs, and how they are protected.
- Whether you mask obvious personal data such as emails and card-like numbers before storing. Tell visitors not to enter payment details in the chat.
- What your privacy notice says about AI processing and which third-party provider receives the text.
Check the provider's current data-retention and data-use terms. If your visitors are in regions covered by data-protection law such as GDPR, ask a qualified adviser what applies to you, since requirements change. For the general approach, see building privacy into web applications.
Measuring usefulness
Do not publish performance claims unless you have measured them on your own traffic. Pick measures that map to the job you defined:
| Question | Signal to look at |
|---|---|
| Does it answer correctly? | Weekly review of a sample of conversations, scored by a person against the source content |
| Do visitors find it helpful? | Thumbs up or down on answers, and what people write when they mark one down |
| Does it reduce workload? | Volume of repetitive tickets before and after, compared over a similar period |
| Does the handoff work? | Share of handoffs that arrive with enough context, and time to first human reply |
| Is it worth the cost? | Provider usage cost plus maintenance time against the time saved |
Read actual transcripts regularly. Numbers tell you something is off; transcripts tell you why. Questions the bot could not answer are a free list of gaps in your website content.
Rollout in stages
- Internal pilot. Staff use it against real questions and flag bad answers.
- Limited exposure. Show it on one or two pages, or to a small share of visitors, with a visible feedback button.
- Review and tune. Fix content gaps first, prompts second, model changes last.
- Wider launch. Add pages and topics only after the earlier stage looks solid. Keep a switch that disables the bot instantly.
Plan for ongoing ownership too: content updates, log review and provider changes do not end at launch.
Putting it together
Write the job in one sentence, give the bot only content you stand behind, make the exit to a human easy, and review real conversations every week. If you want help scoping a chatbot into an existing site, see our software development overview or send a short description of what you want it to do.
Frequently asked questions
What should a chatbot not answer?
Anything outside your business, regulated advice such as medical, legal or financial guidance, and commitments the data does not support, like prices, refunds or delivery dates. It should also refuse questions about other customers or internal systems, and offer a human or a contact page instead of improvising.
How do I keep answers accurate?
Answer from your own maintained content rather than the model's general knowledge, using retrieval and an instruction to say when nothing relevant is found. Assign an owner to each source, re-index when pages change, show the source link with answers, and review a sample of real conversations every week.
How do I measure success?
Tie measures to the job you defined. Review sampled conversations for correctness, collect thumbs up or down, compare repetitive ticket volume over similar periods, check how well handoffs arrive with context, and weigh usage and maintenance cost against time saved. Only publish figures you measured yourself.