

# Amazon Q embedded
<a name="embed-amazon-q-business"></a>

Amazon Q embedded is a feature that lets you embed the Amazon Q Business assistant within websites that you trust. The Amazon Q assistant is powered by generative AI and can be configured to answer questions, provide summaries, generate content, and complete tasks based on your enterprise data. This allows your end users to receive immediate, permissions-aware responses from enterprise data sources, with citations.

For example, if you have a company intranet website, you can create an Amazon Q web experience by using your company data. You can then embed this web experience on your website. Your users can log in to the chat experience using their company credentials and ask the embedded Amazon Q Business chat experience questions. Your users receive responses based on the data sources used by the Amazon Q application environment.

**Topics**
+ [Prerequisites](#prerequisites)
+ [Add your website as an allowed URL](add-website-as-allowed-url.md)
+ [Add Amazon Q embedded to your website](embed-web-experience.md)
+ [Remove your website as an allowed URL](remove-website-as-allowed-url.md)

## Prerequisites
<a name="prerequisites"></a>

Before you can embed the Amazon Q Business web experience in your websites, you must complete the following steps.

1. [Get started with Amazon Q Business](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/getting-started.html)

1. [ Create an IAM Identity Center-integrated application](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/create-application.html), or [Create an IAM federated application](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/create-application-iam.html), or [Create an anonymous access application](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/create-anonymous-application.html) and create your Amazon Q Business web experience.

# Add your website as an allowed URL
<a name="add-website-as-allowed-url"></a>

To configure allowed websites for your existing web experience, you can use the Amazon Q Business console or the Amazon Q Business API.

**Note**  
The allowed *base URLs* must begin with `https://` or `http://`.
You must only submit a *base URL*, and not the full path. For example, `https://docs.aws.amazon.com`.

## Using the console
<a name="add-website-as-allowed-url-console"></a>

1. Sign in to the [Amazon Q console](https://console.aws.amazon.com/amazonq/business/).

1. Choose **Applications**, then select the name of your application from the list.
**Note**  
Copy and save the **Deployed URL** for your Amazon Q application. You'll need this URL when you embed the web experience on your website.
For [anonymous applications](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/create-anonymous-application.html), the **Deployed URL** must be generated every time using the `[ CreateAnonymousWebExperienceUrl](https://docs.aws.amazon.com/amazonq/latest/api-reference/API_CreateAnonymousWebExperienceUrl.html)` API operation. For more information, see [Share an anonymous web experience](supported-exp-actions-anonymous.md#create-experience-anonymous-url).

1. From the left navigation pane, choose **Amazon Q embedded** under the **Enhancements** section.

1. On the main page, choose **Add allowed website** and enter the *base URL* of the website where you'll be embedding the Amazon Q Business web experience.

## Using the AWS CLI
<a name="add-website-as-allowed-url-cli"></a>

```
aws qbusiness update-web-experience \
  --application-id application-id \
  --web-experience-id web-experience-id \
  --origins origins

aws qbusiness get-web-experience \
  --application-id application-id \
  --web-experience-id experience-id
```

The `get-web-experience` operation will return the `defaultEndpoint`, which is the web experience URL that you will embed in your website.

# Add Amazon Q embedded to your website
<a name="embed-web-experience"></a>

You can embed your Amazon Q Business web experience by adding an `<iframe>` element to your website with the **Deployed URL** or `defaultEndpoint` you copied earlier as the `src` value and a minimum width of *450 pixels* as follows.

```
<iframe src="Deployed-URL-or-defaultEndpoint" style="min-width: 450px;"/>
```

Once this <iframe> is added to the website, the Amazon Q Business chat assistant will show up and be ready to be used by your authenticated Amazon Q users.

Amazon Q Business users must provide user authentication credentials before they can use the embedded Amazon Q chat experience on your website. These credentials are the same as the credentials required for the Amazon Q web experience. To authenticate, Amazon Q opens a new browser tab or window where users can enter their credentials. Once successfully authenticated, users can close this tab or window and begin using the embedded Amazon Q chat experience within the website.

**Note**  
For [anonymous applications](https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/create-anonymous-application.html), the **Deployed URL** must be generated every time using the `[ CreateAnonymousWebExperienceUrl](https://docs.aws.amazon.com/amazonq/latest/api-reference/API_CreateAnonymousWebExperienceUrl.html)` API operation. For more information, see [Share an anonymous web experience](supported-exp-actions-anonymous.md#create-experience-anonymous-url).
If your browser has a limited cookie mode (ex. Incognito mode in Chrome), you may have to enable third-party cookies for Amazon Q embedded to work. 
 The button for copying may not work without `allow="clipboard-read; clipboard-write"` attribute added to iframe 

# Remove your website as an allowed URL
<a name="remove-website-as-allowed-url"></a>

To remove a website(s) from list of allowed websites, you can use the Amazon Q Business console or the Amazon Q Business API.

## Using the console
<a name="remove-website-as-allowed-url-console"></a>

1. Sign in to the [Amazon Amazon Q Console](https://console.aws.amazon.com/amazonq/business/).

1. Choose **Applications**, then select the name of your application from the list.

1. From the left navigation, choose **Amazon Q embedded** under the **Enhancements** section.

1. On the main page, select the website that you want to remove and choose **Remove** and confirm your choice.

## Using the AWS CLI
<a name="remove-website-as-allowed-url-cli"></a>

To remove the website from the list of allowed websites, you will need to use the `get-web-experience` operation to get a list of all your allowed website URLs `origins` and remove the website that you no longer want to work with Amazon Q embedded and resubmit the rest of the URLs using the `update-web-experience` operation. Otherwise, all your other allowed websites will also be removed.

```
 aws qbusiness get-web-experience \
  --application-id application-id \
  --web-experience-id web-experience-id \  
                    
aws qbusiness update-web-experience \
  --application-id application-id \
  --web-experience-id web-experience-id \
  --origins origins
```

**Note**  
You will need to remove the `<iframe>` element from that website as it will no longer work.