> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.omni.co/feedback

```json
{
  "path": "/embed/customization/ai-chat",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Embedding the Omni Agent

> Integrate a whitelabeled version of the Omni Agent directly into your embedded application.

The [Omni Agent](/ai/chat) can be embedded as a standalone page in your application, allowing your users to explore data outside of workbooks using the same AI-powered experience found in the native Omni app.

<img src="https://mintcdn.com/omni-e7402367/AHZMUT4Yf5W_XcXL/embed/images/full-page-chat.png?fit=max&auto=format&n=AHZMUT4Yf5W_XcXL&q=85&s=bda8ffff71179b9c22ea0d2a3c3564a0" alt="" width="883" height="775" data-path="embed/images/full-page-chat.png" />

## How it works

The embedded Omni Agent uses the same [pickers and scoping behavior](/ai/chat#scoping-responses) as the native Omni app. When embedding, you can tailor the experience to include only the connections, models, and topics you specify.

## Steps

<Steps>
  <Step title="Define connection access">
    The first step is to decide which connections you want your users to have access to when using the Omni Agent. These connections will display in the **Connections** picker below the chatbox.

    Start by retrieving the connections' unique IDs. Later in this guide, you'll use the IDs to construct a `connectionRoles` parameter and configure the embed session. You can retrieve connection IDs using either of the following methods:

    <AccordionGroup>
      <Accordion title="From connection settings">
        In Omni:

        1. Navigate to **Settings > Connections**.
        2. Click on the connection.
        3. At the top of the **Settings** tab, locate the **Connection ID** field:
                   <img src="https://mintlify.s3.us-west-1.amazonaws.com/omni-e7402367/images/docs/embed/external-embedding/assets/images/connection-settings-id-39740e7ca3da06e4f50733119dbd57d5.png" alt="" />
      </Accordion>

      <Accordion title="Using the API">
        To programatically retrieve connection IDs, use the [List connections API](/api/connections/list-connections).

        If you want to retrieve a specific connection - such as a connection specific to a client - use the endpoint's filtering functionality. In this example, the request will retrieve a connection named `Blobs R Us`:

        ```shell wrap title="GET /api/v1/connections" theme={null}
        curl -X GET 'https://blobsrus.omniapp.co/api/v1/connections?name=Blobs+R+Us' \
        --H 'Authorization: Bearer <TOKEN>' \
        --H 'Content-Type: application/json'
        ```

        Valid requests to the API will return a `200 OK` status and a response body containing `connection` objects. Each object will the connection's unique `id`.
      </Accordion>
    </AccordionGroup>
  </Step>

  <Step title="Curate the topic list">
    Next, you'll curate the list of topics you want users to have access to in the topic picker:

    <img src="https://mintlify.s3.us-west-1.amazonaws.com/omni-e7402367/images/docs/embed/external-embedding/assets/images/chat-topic-picker-2b7119f35cc00379e846c54481e200bb.png" alt="" />

    This is accomplished with the [`ai_chat_topics`](/modeling/models/ai-chat-topics) model parameter. This parameter accepts a list of topic names, which will limit access only to the specified topics.

    In Omni, navigate to the models associated with the connections from step 1. Add the `ai_chat_topics` parameter and specify the topics that users should have access to:

    ```yaml title="Example model file" theme={null}
    ai_chat_topics: [ Product Performance, Order Transactions]
    ```

    Refer to [Scoping AI chat responses](/ai/chat#scoping-responses) for details on how topic configuration affects the picker display and AI behavior.

    <Tip>
      You can add [sample queries](/modeling/develop/ai-optimization#add-example-queries-as-context) to accessible topics, which will display in the chat interface as clickable questions:

      <img src="https://mintlify.s3.us-west-1.amazonaws.com/omni-e7402367/images/docs/embed/external-embedding/assets/images/ai-chat-prompts-48cdefde7d2bfc461b8d657fd298b721.png" alt="" />

      Refer to the [Optimizing models for AI guide](/modeling/develop/ai-optimization) for more information about curating topics for AI.
    </Tip>
  </Step>

  <Step title="Define embed parameters">
    The next step is to define the embed parameters to create the chat session for the user. Along with the [required parameters](/embed/setup/url-parameters#required-parameters) - `externalId`, `name`, and `nonce` - set the following parameters:

    * [`contentPath`](/embed/setup/url-parameters/contentPath) - Set to `/chat`
    * [`connectionRoles`](/embed/setup/url-parameters/connectionRoles) - Use the connection IDs from step 1 of this guide to build an object that specifies the connection roles available to the embed users. For example:

      ```json wrap theme={null}
      {  
        "c0f12353-4817-4398-bcc0-d501e6dd2f64":"RESTRICTED_QUERIER"
      }
      ```

    If you're using [standard SSO embed](/embed/setup/standard-sso) to create embed sessions, the embed URL you build might look like the following:

    ```shell wrap theme={null}
    https://omni.blobsrus.com/embed/login?&connectionRoles=%7B%22c0f12353-4817-4398-bcc0-d501e6dd2f64%22%3A%22RESTRICTED_QUERIER%22%7DcontentPath=%2Fchat&externalId=Blobs+R+Us&mode=SINGLE_CONTENT&name=Blobby&nonce=yRt9RbPRST1pKP0fv4hkZkOcyydnwmWX&signature=prfIqNKkUBYlXiAdXLe_E__w19QbM_-6o3CIi4kkV1s
    ```

    <Tip>
      To enable voice mode, add the `microphone` permission to your iframe's `allow` attribute. Browsers will block microphone access by default without this permission.

      ```html theme={null}
      <iframe src="https://omni.blobsrus.com/embed/login?..." allow="microphone"></iframe>
      ```
    </Tip>
  </Step>

  <Step title="Apply your branding">
    After you've successfully configured and created an embed session, the last step is to apply your branding styles. While this last step is **optional**, it allows you to make the Omni Agent your own and blend it seamlessly with your application.

    Navigate to **Settings > AI** and then click the [**Branding** tab](/ai/settings/branding).

    <img src="https://mintlify.s3.us-west-1.amazonaws.com/omni-e7402367/images/docs/embed/external-embedding/assets/images/ai-settings-chat-458e60c3f4b98af69c816e3301eace36.png" alt="" />

    Use the settings to configure how you want the Omni Agent to look and then click **Save**.
  </Step>
</Steps>
