Before you start, make sure you have: - The homie embed script installed on your site (see
Manual) - A page in your shop that should show the assistant, for example
/assistantAdd the embedded chat to a page
1
Add the container
Add an empty element with the ID The chat fills the container completely. You decide its height: in the example, the container takes the full screen height minus a 64-pixel navigation bar.
homie-embedded-chat where the chat should appear, below your navigation bar. The ID is fixed and cannot be changed. Leave the element empty: content inside it is not shown.assistant.html
2
Switch the page to the embedded chat
Set
window.homieBotConfig.embeddedChat before the embed script loads. This tells the script that this page shows the embedded chat instead of the widget:assistant.html
Install the embedded chat with the homie embed script as shown here. Use the same assistant configuration as
on your other shop pages.
3
Open the page
Reload the page. The chat appears in the container with its input at the bottom.
On a page with
embeddedChat, the floating widget never appears. If the page has no element with the ID
homie-embedded-chat, the script shows a warning in the browser console and displays nothing.Options
embeddedChat accepts these options:
string
Optional plain-text heading above the conversation. Leading and trailing whitespace is removed. If omitted or blank, a greeting in the chat language is shown (e.g. “Hello”).
string
Optional page to use as context, for example the product page the shopper came from. It determines the product
context, greeting, starter questions, and page settings. Relative URLs resolve against the current page. If omitted
or blank, the browser’s referring page is used only if it is a different page with the same protocol, hostname, and
port. Otherwise, the assistant page provides the context.
Example: from a product page to the assistant page
A button on your product page opens the assistant page and passes the product page along:product-page.html
assistant.html
/products/rain-jacket-123 are resolved against your shop’s address.
Ask “What is this product made of?” on the assistant page. The assistant answers about the product from the page you
came from.
Shops that change pages without reloading
If your shop changes pages without a full reload (a single-page app), the script loads once and keeps running. Do not setembeddedChat in that case. Instead, show and remove the embedded chat yourself with two methods. Like all methods of the
Client API, they are available once the API is ready, so wait for the homiebot:api-ready event:
window.homieBot.mountEmbeddedChat(options)hides the widget and shows the chat in#homie-embedded-chat. It accepts the sametitleandcontextUrloptions. Call it after the assistant page has rendered the container.window.homieBot.unmountEmbeddedChat()removes the chat and brings the widget back. Call it when the shopper leaves the assistant page.
contextUrl here: the browser’s referring page does not update when you
change pages without reloading. As long as the embedded chat is shown, the widget stays hidden.
Layout on mobile devices
- The chat column is centered and up to about 760 pixels wide; on narrow screens it uses the full width.
- Only the conversation scrolls. The header with the assistant’s name and the reset button stays at the top, the input stays at the bottom.
- Use
dvhunits for the container height, as in the examples, so the input stays visible when the on-screen keyboard opens. - Product links open in a new tab, so shoppers keep the conversation open.
Troubleshooting
Nothing appears on the assistant page
Nothing appears on the assistant page
Check that the container has exactly the ID
homie-embedded-chat and exists when the script runs or when you
call mountEmbeddedChat. The browser console shows a warning if the element is missing.The widget appears instead of the embedded chat
The widget appears instead of the embedded chat
Check that
window.homieBotConfig.embeddedChat is set before the embed script loads, or, in a shop without
reloads, that mountEmbeddedChat is called on the assistant page.The chat is not visible or very small
The chat is not visible or very small
The chat takes the height of its container. Give the container an explicit height, for example
calc(100dvh - 64px).The assistant does not know the product
The assistant does not know the product
Pass the product page as
contextUrl. Without it, the previous page is only used when the shopper came from a
page of your own shop with a full page load.Next steps
Configuration
All options of the embed script.
Page configuration
Set greetings and starter questions per page.