Sonia: an AI shop assistant in one script tag

How the Shadow DOM widget shares its panel with A2, how the catalogue search is built, and why product search can run in the shopper's browser

Live product · technical note Alin Rizea · DBM AI · alin.rizea@gmail.com · October 2026 · PDF version · More ideas, and how to collaborate
Try the live demo demo.dbm-ai.com: Sonia running on seven demo shops. Ask about products, prices, delivery, or switch her personality.
Summary Sonia is the shop assistant in FormAI, DBM AI's product for online shops. One script tag adds two assistants to a website: Sonia, who answers product and shop questions, and A2, who helps visitors fill in forms. Both live in one chat panel inside a closed Shadow DOM, so the shop's styles and scripts cannot break it and it cannot break the shop. Sonia's product search is built from the shop's own WooCommerce data. When a shop's host blocks requests from our servers, which some small hosting providers do to every datacenter IP address, the search moves into the shopper's browser: our server plans the queries, the browser runs them against the shop's public API from the shop's own page, and our server writes the answer from the real results.

1. What Sonia and A2 do

The Sonia chat panel on a shop page: a dark panel titled Sonia Shop Assistant with an English language selector, a welcome message, a text box with a microphone button, and Sonia's avatar in the corner.
Sonia on a shop page. Language selector, wishlist, voice input and read-aloud replies.

Sonia works like a good shop assistant. She finds products, gives the exact details (SKU, price, stock, sizes, colours), compares items, makes suggestions, answers questions about delivery, returns and contact details, and hands the conversation to a person when the visitor asks for one. She offers the wishlist after showing products and a restock alert when something is out of stock. She speaks in one of eleven personality presets that the shop owner picks, and visitors can type or talk to her and hear her reply. Her answers must come only from data her tools return: she never invents a product, a price, a currency or a policy.

A2 is the form helper. It finds every form on the page, including forms added later by single-page apps and AJAX, puts a ? button and a microphone next to each field, explains what a field needs, and chats about the form in the language set for it. Before anything leaves the browser, personal data such as email addresses, phone numbers, card numbers and IBANs is swapped for placeholders, using checksums to avoid false matches, so the language model only ever sees the placeholders. The real values are put back when the reply arrives.

The same data also powers AI Search: a visitor types something like “orange leather bag under 300” into the shop's own search box and lands on the shop's filtered results page, with a short note on how the query was understood.

2. One script tag, one Shadow DOM

An assistant that sits on other people's websites has to survive their CSS. Shop themes reset every element, use !important freely and load dozens of plugins. A widget built with ordinary page elements gets restyled by the theme, and its own styles leak into the shop. So the chat panel is built inside a closed Shadow DOM: a separate DOM tree attached to one host element, with its own styles. The theme's CSS stops at the boundary, the widget's CSS stays inside, and in closed mode the page's scripts cannot reach in either.

A2 lives in two places at once. Its ? and microphone buttons have to sit next to the shop's own form fields, so they are added to the page itself, with inline styles to keep clashes small. Its conversation lives in the same panel as Sonia's. Pressing “Chat” in a field's help switches the panel to A2 mode, keeps Sonia's messages aside, and shows a toggle to switch back. Each mode keeps its own history, so the visitor can move between “help me with this form” and “do you have this in blue?” without losing either.

The shop's page theme CSS, plugins, the shop's own scripts Checkout form (the shop's own) Email Phone VAT number ? ? ? A2 buttons, added to the page Closed Shadow DOM theme CSS and page scripts stop here Sonia · shop A2 · this form One panel, two modes. Each mode keeps its own messages; a toggle switches between them. Ask anything… “Chat” opens A2 mode
Figure 1. One script tag, two places on the page. A2's buttons sit beside the shop's own fields; both conversations share one panel inside a closed Shadow DOM.

3. How the search is built

“Orange leather bag under 300” is only searchable if the assistant knows the shop calls that category Genți, that colour is an attribute called Culoare with a term Portocaliu, and that prices are in lei. So every shop gets a store schema, built from its WooCommerce data, with seven parts:

A router model reads the visitor's question with this schema in view and turns it into precise search parameters: a category, attribute terms, a price limit, a sort order. The search then runs against the shop's real catalogue, and the answer model writes the reply from the products that come back.

The schema can be built two ways:

Shop knowledge (policies, delivery, FAQs, contact details) comes from crawling the shop's pages. If the host blocks our crawler, the owner opens their own shop once with a one-time link from the dashboard, and their browser pages through the site and sends the content back for the same extraction.

4. When the shop's host blocks our servers

Some small hosting providers block every request from datacenter IP addresses, because that is where most scrapers and attacks come from. Our servers run on AWS, so for a shop on such a host, Sonia's product search returned nothing, even though the same shop opened fine in any browser.

Table 1. Options considered.

OptionWhy not, or why
Route our requests through residential proxiesPaid per gigabyte, gets expensive at scale, and adds an outside dependency
Add a search endpoint to the WordPress pluginNeeds a new plugin release and every shop to update before it helps
Let the shopper's browser run the search (chosen)The browser is already on the shop's page, and the shop never blocks its own visitors
Shopper's browser on the shop's page Our server AWS, datacenter IP Shop's host WooCommerce Store API ✕ blocked: datacenter IP 1 · “orange bag under 300?” 2 · planned queries + signed token 3 · all queries in parallel, same origin, no keys 4 · real products from the shop's database 5 · raw products + token 6 · answer checked: count capped, HTML stripped, normalized
Figure 2. Search in the shopper's browser. Our server never contacts the shop; every request to the shop comes from the visitor's own browser, from the shop's own page.

5. How it is tested

6. Limits

7. Try it, or talk to me

The live demo is at demo.dbm-ai.com, with Sonia on seven demo shops. I'm happy to talk with shop owners, agencies building on WooCommerce, and engineers who have solved the same problems in other ways. Email alin.rizea@gmail.com, message me on LinkedIn, or open an issue.