Home · Insights · Implementation

How we built the AI chat widget on our own website

We recommend things we have run ourselves. The assistant on our website is one of them. Here is how it works, the rules we gave it, and what we would do differently if you were starting from scratch.

What we wanted it to do

A website visitor often has a question that is not on any page, and a form feels like too much commitment for a first question. We wanted a small chat box that answers honestly from what our site says, and, when it makes sense, hands the visitor to a person. It is deliberately narrow. It is not a support desk and does not try to be.

How it is put together

Visitor typeson the websiteAutomationworkflowAI modeldrafts the replyReply shownon the pageOnce, when it has enough context:Book a call | WhatsApp
The whole path. The page does not talk to the AI directly. It talks to a workflow we control, and the workflow decides what is sent and what comes back.

The page keeps the conversation so far and sends it to a workflow in our automation tool whenever the visitor sends a message. The workflow adds our instructions, asks the AI model for a reply, and returns it. That indirection is the important design choice. The AI key never sits in the visitor's browser, and everything the model is told lives in one place we can change without touching the site.

The model also decides when it has heard enough to be useful. When it does, it adds a marker at the end of its reply. The workflow removes the marker before the reply goes back and sends a short summary of the conversation instead, which the page uses to show two buttons: book a call, or message us on WhatsApp with the summary pre-filled. The offer appears once, and never on the first reply, because pushing a call at someone who has just said hello reads as a sales script.

The rules we gave it

One job: pre-sales questions, short repliesNever invents a client, case study or resultPricing: depends on scope, never a numberNever offers the next step on its first replyNext step offered once: call or WhatsAppPlain error message if the workflow fails
The rules are plain statements written in the assistant's instructions. The ones that matter most are listed here.

The instructions are short. They give it one job, say it must ask at most one clarifying question, keep replies to two to four sentences, never state a price (pricing depends on scope), and never invent a client, a case study or a result. If you build one yourself, test it with the questions it should refuse, and spend your time there, not on how clever the reply sounds. For more on writing instructions that hold up, see whether you need prompt engineering.

What it cannot do, on purpose

If the workflow is down, the visitor sees a short, plain message and the rest of the site works as normal. A chat box that breaks the page is worse than no chat box.

What we would tell you before you build one

  1. Decide the one job first. Answer pre-sales questions and route to a person. Do not also make it your support desk. One honest caveat: our assistant's instructions are not grounded in a knowledge base of the site, so it relies on a short description of what we do. A knowledge base is the next improvement we would make.
  2. Keep the key and the instructions server-side.
  3. Always leave a path to a person, and make sure someone is there to receive it, using the discipline in speed to lead.
  4. Tell people it is an assistant. We labelled ours as an AI assistant in the header when we checked this post against our own widget. The EU AI Act sets transparency duties for chatbots; see the EU AI Act now.

If you want one on your own site, this is what we build under AI chat for Mallorca business websites.

Want a chat assistant that stays inside limits?