Embedded Chat: Configuration and User Identity
Website Chatbot places a chat widget on your website. Visitors send requests to the published workflow from that widget. Configure the workflow’s fields and access rules in StackAI, then copy its generated embed code into your website.
Before you begin
A workflow with a message input and an output to display.
Permission to configure and publish its interface, or an authorized reviewer who can approve publication.
Access to your website’s HTML or React application.
Choose and configure Website Chatbot
Open the project’s Interface tab. Select Website Chatbot from the interface selector.
In Fields, select the workflow input that receives messages and the output that supplies the answer. An alias changes the displayed label, not the underlying node.
Set the name, description, and input placeholder in General. Under Style, configure the chat bubble color, border radius, and whether the chat opens by default.
In Security, configure the access controls for your audience. See the distinctions below.
Select Save, then Publish. If approval is required, complete the release request and wait for approval.
Copy the embed code
Select Embed to open Code Export. Choose HTML or React and copy the generated code. Keep the project URL generated for your interface.
For an HTML website, place the generated script immediately before the closing </body> tag. Its structure is:
Replace YOUR_GENERATED_EMBED_URL with the URL in Code Export. Do not construct it from a personal API key.
For React, install the react-stackai package in your application and use the component shown in Code Export:
Access and user identity
Enable Password protection
Requires the interface password before the visitor can use the chat.
A shared password does not identify an individual organization member.
Make it private to your organization (SSO)
Requires organizational sign-in for the interface.
Signing in to your website alone does not sign the visitor in to StackAI.
Allowed source URLs
Restricts the source page URLs allowed to display or access the interface.
A permitted source page URL does not establish a visitor’s identity.
Generated embed URL
Identifies the interface that the widget opens.
It is not a private credential for general StackAI API requests.
For Allowed source URLs, add the exact URL of each page that embeds the widget, including its path and trailing slash when present. A domain entry alone does not authorize every page under that domain. The browser must supply a matching referrer; a website policy that suppresses it can prevent access.
Do not add a private personal API key to the script, component, or other browser code. Configure access in the interface’s Security settings and publish those changes.
Verify the website experience
Open the page as an intended visitor, including from a signed-out browser when checking access requirements. Confirm that:
The widget appears and opens without covering controls when closed.
The required password or organization sign-in appears before the chat can be used.
A submitted message reaches the workflow and its mapped output appears in the chat.
Troubleshooting
No widget appears
Confirm that the website includes the generated script or React component and permits its script source. Check the browser console for loading errors.
The widget opens but the interface is unavailable
Confirm that the workflow is published and the embed URL matches the intended interface. A saved draft or pending release request is not a published release.
It works in preview but not on the website
Compare the embedding page’s exact URL with Allowed source URLs, and check whether the browser sends a referrer and the visitor can authenticate.
A request produces no displayed answer
Inspect the run and verify the message input and output mappings in Fields.
Related resources
Was this helpful?

