> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/interfaces-and-conversations/embedded-chat-configuration-and-user-identity.md).

# 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.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FQvYgwyIyYiuSJZQ8mXCA%2Fembedded-chat-configuration-and-user-identity.mp4?alt=media&token=0e7ff5e7-9a3d-4f0c-b579-493b34295855>" %}
Review the Website Chatbot preview, generated embed snippet, and access controls. This walkthrough shows configuration; publish the intended version before deploying the embed.
{% endembed %}

## 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

1. Open the project’s **Interface** tab. Select **Website Chatbot** from the interface selector.
2. 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.
3. 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.
4. In **Security**, configure the access controls for your audience. See the distinctions below.
5. Select **Save**, then **Publish**. If approval is required, complete the [release request](https://docs.stackai.com/guides-and-quickstarts/releases-and-environments/create-a-project-pull-request.md) 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:

```html
<script
  src="https://unpkg.com/react-stackai@latest/dist/vanilla/vanilla-stackai.js"
  data-project-url="YOUR_GENERATED_EMBED_URL">
</script>
```

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:

```jsx
import Stack from 'react-stackai';

export default function ChatWidget() {
  return <Stack project="YOUR_GENERATED_EMBED_URL" />;
}
```

## Access and user identity

| Setting or identifier                          | What it controls                                                           | What it does not do                                                       |
| ---------------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| **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](https://docs.stackai.com/guides-and-quickstarts/interfaces-and-end-user-experiences/interface-authentication-and-access.md).

## Verify the website experience

Open the page as an intended visitor, including from a signed-out browser when checking access requirements. Confirm that:

1. The widget appears and opens without covering controls when closed.
2. The required password or organization sign-in appears before the chat can be used.
3. A submitted message reaches the workflow and its mapped output appears in the chat.

## Troubleshooting

| Symptom                                           | Check                                                                                                                                                         |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 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

[Publish a Chat Assistant](https://docs.stackai.com/guides-and-quickstarts/interfaces-and-end-user-experiences/publish-a-chat-assistant.md)

[Interface authentication and access](https://docs.stackai.com/guides-and-quickstarts/interfaces-and-end-user-experiences/interface-authentication-and-access.md)

[Run Records, Node Traces, and Error Details](https://docs.stackai.com/technical-reference/evaluations-and-observability/run-records-node-traces-and-error-details.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/technical-reference/interfaces-and-conversations/embedded-chat-configuration-and-user-identity.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
