Voice Agents · 9 min read · For everyone
Web Widget
Put your voice agent on any website as a chat window, a voice call button or both, with product buttons and support tickets.
The web widget puts your voice agent on your own website. Visitors press a button and chat with the agent by text, talk to it by voice in the browser, or both in one window. You paste one piece of code into your site once; whatever you save later in LemuAI reaches your site by itself.
The widget can also show the products your agent looks up as cards with your own buttons (like Add to cart), and let the agent open support tickets in Lemu Tickets for visitors it can verify.
Before you start#
- A voice agent to put on the site (see Voice Agent Builder).
- For product cards: a catalog the agent looks items up in (see Catalog).
- For support tickets: Lemu Tickets connected in Settings → Integrations (see Lemu Tickets).
Steps#
Open the Deploy dialog
Open your voice agent and press Deploy Workflow in the editor toolbar. The dialog is called Put your agent on your website, with a Live preview of the widget on the right that you can try.
Setup
Under What visitors can do, pick Chat and call (one window for both: a call carries on from the chat, and the chat from the call), Chat, or Call.
Under Websites it works on, type your site, such as
yourshop.com, and press Add.*.yourshop.comcovers every subdomain, andyourshop.comalso coverswww.yourshop.com. Anywhere else the widget doesn't show.Button, Window and Behaviour
Match the widget to your site. The fields are listed in Customization below. The preview changes as you go.
Products & tickets (optional)
Turn on product cards and choose their buttons, and let the agent open tickets for verified visitors. See Product cards and buttons and Support tickets.
Save and get the code
Press Save and get code. The dialog moves to Add to website.
Add to website
- Copy the code and paste it just before the closing
</body>tag of a template or footer that every page uses. Pick Your website is built with (Any website, Shopify, WordPress, Wix, Webflow, Google Tag Manager, React / Next.js) to see where that is on your platform. - With tickets on, Tell the widget who's signed in (see Customers signed in on your website).
- Check it on your website: open a page of your site and press the widget's button.
Email these steps to my developer opens an email with the code and the steps.
- Copy the code and paste it just before the closing
Check it worked#
- The switch at the top of the dialog says Live on your website, and the line at the bottom says your website has the latest settings.
- On your site, the button shows in the corner you chose and opens the chat or starts a call.
- Each chat and call shows up in the agent's runs like any other conversation.
To take the widget off your site, turn off Live on your website and confirm Take the widget off your website?. The code can stay on your site; it shows nothing until you turn the widget back on.
Customization#
Button
| Field | What it does |
|---|---|
| Style | Circle, Square, Pill (icon and text in one button) or Side tab (a tab on the edge of the screen). |
| Button text | Up to 60 characters. Show the text next to the button shows it beside a Circle or Square. |
| Icon | Phone, Headset, Microphone, Voice wave, Chat bubble, Message, Sparkles, Question mark, or Your image (an Image link starting with https://). |
| Size | Small, Medium or Large. |
| Corners | Sharp, Rounded or Round. |
| Button colour | A hex colour like #664AE2. |
| Icon and text colour | A hex colour, or Auto (black or white, whichever reads better). |
| Shadow | None, Soft or Strong. |
| Attention effect | None, Pulse or Bounce, until the visitor first uses the widget. |
Window
| Field | What it does |
|---|---|
| Theme | Light, Dark, or Match visitor's device. |
| Title, Subtitle | The window's header. |
| Avatar image link | A small picture in the header, starting with https://. |
| Message box placeholder | The grey text in the empty message box. |
| Window size | Compact, Standard or Large. On phones the window fills the screen. |
Behaviour
| Field | What it does |
|---|---|
| Position | Bottom right, Bottom left, Top right or Top left, with the Distance from the side (useful to stay clear of a cookie banner). |
| Greeting message | A small bubble next to the button, once per visit, after the Greeting delay in seconds. |
| Font | Standard, or Match my website. |
| Show on phones | Off hides the widget on phones. |
| Use my own button instead | Hides the floating button; open the widget from your own button with LemuWidget.open(). |
Product cards and buttons#
When your agent looks products up with a catalog tool, the widget can show them as cards with a photo, name, price (with the MRP struck through) and up to two buttons. Cards are built from the catalog, never from what the agent writes, so a card can't carry a made-up price or link. A product needs a name and a product page link in the catalog to get a card.
Turn on Show products as cards in Products & tickets, then set the buttons:
| Field | What it does |
|---|---|
| Main button | The filled button on each card. Label up to 24 characters. |
| Second button | Optional, outlined. Add a second button to add it, the bin to remove it. |
| When pressed | Open the product page; Open a link (built from the product, like https://yourshop.com/cart/add?id={variant_id}); Send a message to the agent (like Is {title} available in size 9?, not on Call widgets); or Run a function on your website (a function your site adds, see Product buttons from your own code). |
| Product pages open in | Same tab (the chat stays open on the next page) or New tab. During a call a card opens a quick view instead, so the call isn't cut. |
Links and messages can use these product details: {title}, {sku}, {variant_id}, {product_id}, {price}, {url}, {size}, {colour}. For a Shopify store connected to LemuAI, {variant_id} is Shopify's variant ID (what Shopify's cart takes) and {product_id} is Shopify's product ID.
Every press of a card button is recorded as a product_button_clicked event with the button's label and the product's details, so you can see it in the Event Log and start a journey from it. When the visitor is verified (see below), the event is on their contact.
Support tickets#
The agent can open a ticket in Lemu Tickets when a visitor has a problem it can't solve, in the chat and on calls, and tell them the ticket number. Only verified visitors can get a ticket. A visitor the widget can't verify gets the message you set and is shown how to verify; no ticket is opened for them, and the agent can't tell them about any tickets.
Turn on Agent can open tickets for verified visitors in Products & tickets (it needs Lemu Tickets connected). On your website these settings replace the agent's own ticket options from Tools & files for every step (see Agent Node).
| Field | What it does |
|---|---|
| When to open a ticket | Plain words the agent follows, like "A refund started more than 5 days ago that hasn't arrived. A damaged or wrong item." Up to 1,000 characters. |
| Priority when the agent doesn't choose one | P1 (urgent) to P4 (low). Default P3. |
| Project for new tickets | A Lemu Tickets project, or Default project. |
| Agent can tell visitors the status of their tickets | The agent can look up the verified visitor's own tickets. |
| Customers signed in on your website | Always on. Shows the widget's secret (with Copy secret) that your server signs with. |
| Visitors can verify their phone with a WhatsApp code | For visitors who aren't signed in. Pick the WhatsApp template for the code: an approved Authentication template. Each code is one WhatsApp message paid from your WhatsApp balance. |
| What the agent tells visitors who aren't verified | Up to 300 characters. Default: "To raise a support request, please sign in to your account first, then come back to this chat." |
| Sign-in page link (optional) | Shown as a Sign in button in the chat or call window. During a call it opens in a new tab, so the call isn't cut. |
Use See it in the preview: Verified visitor / Not verified to see both cases in the Live preview.
How a visitor is verified#
- Signed in on your website. Your site tells the widget who is signed in, with a signature your server makes (below). The widget sends it with the chat or call. A visitor who signs in after starting a chat is verified on the next page they open.
- A WhatsApp code. The agent's reply shows Verify it's you to raise a request. The visitor types their number with the country code (
+91 98765 43210), presses Send code, and types the 6 digits from WhatsApp. In a chat, the agent then carries on and opens the ticket. On a call, the window says "You're verified. Tell the assistant to go ahead." and the agent opens the ticket when asked again.
The ticket's requester is always the verified visitor: their email or phone, never details the page or the conversation gave. The ticket shows in the chat or call window as a card with its number and status. Tickets from the widget have the source web_chat (chat) or voice (call).
Customers signed in on your website#
Before the widget code, put the signed-in customer in window.LemuWidgetConfig.user. Make the signature on your server, never in the browser, because the secret must stay secret:
signatureis the HMAC-SHA256, in lower-case hex, of the customer's email in lower case, made with the widget's secret.- With no email, sign the phone number in international format with the
+, like+919876543210, and passphoneinstead ofemail.
{% if customer %}
<script>
window.LemuWidgetConfig = {
user: {
email: {{ customer.email | downcase | json }},
name: {{ customer.name | json }},
signature: {{ customer.email | downcase | hmac_sha256: "YOUR_WIDGET_SECRET" | json }}
}
};
</script>
{% endif %}Shopify's Liquid example puts the secret in your theme's code, which only your store's staff can read. Don't put the secret in JavaScript files or anywhere a visitor can download it.
Control the widget from your own code#
Product buttons from your own code#
// A function a card button can run ("Run a function on your website").
// product has sku, variant_id, product_id, title, url, price, mrp,
// currency, in_stock, size and colour.
LemuWidget.registerAction("addToCart", async (product) => {
await fetch("/cart/add.js", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ id: product.variant_id, quantity: 1 }),
});
return { message: "Added to your cart" }; // shown to the visitor for a moment
});
// This page's own buttons (up to two). They replace the ones set in LemuAI on this page.
LemuWidget.setProductActions([
{ label: "Add to cart", run: "addToCart" },
{ label: "Ask about it", message: "Tell me more about {title}" },
// { label: "Size guide", link: "https://yourshop.com/size-guide?sku={sku}" },
// show: (product) => product.in_stock (hide a button for some products)
]);
// Know when a card button is pressed
LemuWidget.onProductAction(({ label, product }) => {
console.log(label, product.sku);
});The same buttons can be set before the widget code with window.LemuWidgetConfig = { productActions: [...] }. A function that throws shows "Couldn't do that. Please try again." to the visitor; a button whose function your site hasn't added shows "This button isn't set up on this site yet."
Open, close and hide#
LemuWidget.open();
LemuWidget.close();
LemuWidget.toggle();
// Start or end a voice call (Call, and Chat and call)
LemuWidget.start();
LemuWidget.end();
// Hide it on some pages, e.g. checkout
LemuWidget.hide();
LemuWidget.show();
// Before the widget code: change settings for one page and
// pass visitor details to your agent's template variables
window.LemuWidgetConfig = {
buttonText: "Ask about this product",
context: { product_name: "Runner Lite", customer_name: "Asha" },
};Settings in LemuWidgetConfig use the names the widget saves, such as buttonText, buttonColor, launcherShape and position. What visitors can do (chat, call or both), product cards and tickets can only be changed in LemuAI. context fills the agent's template variables; it never makes a visitor verified.
Limits#
- Up to 2 buttons per card and 10 cards per reply.
- A chat allows 50 messages from the visitor; after that they start a new chat.
- WhatsApp codes: 3 per conversation a day, 5 per phone number an hour, 10 an hour from one internet address, and one every 30 seconds. A code lasts 10 minutes and allows 5 tries.
Common problems#
- The widget doesn't show on my site. Check that Live on your website is on and your site is under Websites it works on. See Calls and telephony troubleshooting.
- A signed-in customer still has to verify. The signature doesn't match: sign the email in lower case with the secret from Products & tickets, in hex. See Web widget troubleshooting.
- Code errors such as "That code isn't right." are listed in Web widget troubleshooting.
Was this page helpful?
Docs