Embed a workspace
You can embed a workspace that contains a step-by-step guide on your website. Your customers can complete the same guided workflows that your agents and business users complete in their workspaces, such as filing a claim or requesting a refund. Customers complete the guide on your website without signing in to Connect Customer.
To embed a workspace, you create a workspace for customers, add a step-by-step guide to it, and then generate a script that you add to your website.
Prerequisites
An account assigned to a security profile that has the Users and permissions - Workspaces - Create, Workspaces - Edit, and Workspaces - Edit visibility permissions. For more information, see List of security profile permissions in Connect Customer.
Customer Profiles enabled for your instance. For more information, see Enable Customer Profiles for your Connect Customer instance.
An instance that uses the
https://domain. You can't embed a workspace from an instance that uses the legacyyour-instance-alias.my.connect.aws/awsapps.comdomain. For more information, see Update your Connect Customer domain.A step-by-step guide. For more information, see Set up step-by-step guides in Connect Customer.
Step 1: Add your website domain to approved origins
The domain of the website where you embed the workspace must be an approved origin for your instance. Otherwise, the browser doesn't display the embedded workspace.
To add your website domain to approved origins
-
Open the Connect Customer console at https://console.aws.amazon.com/connect/
. Choose the instance alias.
In the navigation pane, choose Approved origins.
Choose Add origin, enter the URL of the website where you embed the workspace, and then choose Add.
For more information, see Use an allowlist for integrated applications in Connect Customer.
Step 2: Create a workspace for customers
To create a workspace for customers
Log in to the Connect Customer admin website at https://
instance name.my.connect.aws/.On the navigation menu, choose UI Management, Workspaces.
Choose Create workspace.
For Who is this workspace for?, choose Customers. You can't change this setting after you create the workspace.
Enter a name for the workspace.
(Optional) Enter a description and a title.
Choose Save. The workspace details page opens, and the workspace visibility is Visible to public.
A workspace for customers is always visible to the public. Anyone who loads the script on a website that's an approved origin for your instance can open the guide.
For general information about workspaces, see Set up workspaces.
Step 3: Add a step-by-step guide
To add a step-by-step guide
On the workspace details page, in the Guide section, choose Add guide.
For Contact flow, choose the flow for your guide. If you don't have permission to browse flows, enter the flow ID.
(Optional) For Container height, enter the height of the guide on your website, in pixels. The default is 480 pixels.
(Optional) For Completion message, enter the text that appears when a customer completes the guide. The default is "You're all set."
(Optional) For Error message, enter the text that appears when the guide encounters an error. The default is "We encountered an error. Reload the page and try again."
Choose Save.
The Guide section shows the flow, container height, completion message, and error message. To change these values, choose Edit. To remove the guide from the workspace, choose Remove.
To enter the guide settings as JSON instead, turn off Use form mode. Use JSON mode to set a container height in a unit other than pixels, such as vh, rem, em, or %.
To fill in the default values, choose Generate. The input data must match the schema that appears next to the editor. The following example shows input data for a guide.
{ "ContactFlowId": "contact-flow-id", "EndScreenMessage": "You're all set.", "ErrorScreenMessage": "We encountered an error. Reload the page and try again.", "Style": { "--connect-application-height": "480px" } }
Step 4: Generate the embed script
To generate the script
On the workspace details page, in the Guide section, choose Generate embeddable script.
-
On the webpage where you want the workspace to appear, add an empty HTML element with an
idattribute. If the page already has an element for the workspace, skip this step.<div id="my-workspace-container"></div>In the next step, for Container ID, enter this value,
. The element must already exist on the page before the generated script runs, and itsmy-workspace-containeridmust be unique on the page. -
On the Generate embeddable script page, enter the following information:
Container ID: Enter the ID of the HTML element on your webpage where the workspace appears. For more information, see the previous step.
Language: Choose the language of the embedded workspace. The default is English.
Theme mode: Choose Automatic, Light, or Dark. The default is Automatic.
(Optional) Start view: Enter the HTML for a view that appears when the workspace loads. The guide loads only after a customer chooses a start button. A start view improves your website's performance and avoids unnecessary costs. We recommend that you use a start view. You can edit the HTML to customize the start view, but it must include a button. To discard your changes to the HTML, choose Reset script.
Choose Update script.
Choose Copy script.
The generated script looks similar to the following example.
<script type="text/javascript"> (function(w, d, x, id){ s=d.createElement('script'); s.src='https://instance-name.my.connect.aws/connectwidget/static/amazon-connect-end-customer-workspace-client.js'; s.async=1; s.id=id; d.getElementsByTagName('head')[0].appendChild(s); w[x] = w[x] || function() { (w[x].ac = w[x].ac || []).push(arguments) }; })(window, document, 'amazon_connect_workspace', 'amazon-connect-workspace-widget'); amazon_connect_workspace('instanceUrl', 'https://instance-name.my.connect.aws'); amazon_connect_workspace('workspaceId', 'workspace-id'); amazon_connect_workspace('styles', { openWorkspace: { color: '#fff', backgroundColor: '#003A70' }, closeWorkspace: { color: '#fff', backgroundColor: '#003A70' } }); amazon_connect_workspace('pageSlug', 'page-slug'); amazon_connect_workspace('getOtc',get-one-time-code-function); amazon_connect_workspace('containerId', 'container-id'); amazon_connect_workspace('locale', 'locale'); amazon_connect_workspace('theme', 'theme-mode'); amazon_connect_workspace('startScreen', `start-view-html`); </script>
The value of getOtc is a function that you write. For more information, see Step 6: Authenticate customers in production.
Step 5: Test the embedded workspace
Test an embedded workspace before you make it available to customers. To test as a customer, your security profile needs the Workspaces - Test permission. For more information, see List of security profile permissions in Connect Customer.
To test the embedded workspace
On the Generate embeddable script page, choose Test as a customer.
For Security profiles, choose the security profiles for the test session. You can choose up to 10.
For Customer profile, choose the customer profile to test as.
Choose Generate code and update script. The script now includes a one-time code.
Choose Copy script, and then add the script to a webpage on an approved origin.
The one-time code works for a single session and expires 5 minutes after it's generated. To test again, generate a new code.
Step 6: Authenticate customers in production
In production, your website gets a one-time code from your backend for each customer session. Your backend calls the CreateAuthCode API with the customer's profile ID, your Customer Profiles domain name, and the security profiles for the session. A one-time code can include up to 10 security profiles. At least one of these security profiles must have the Workspaces - Embed permission. For more information, see List of security profile permissions in Connect Customer.
Each embedded session is authenticated as the customer profile that you specify, not as a Connect Customer user. To authenticate these sessions, Customer Profiles must be enabled for your instance.
Service quotas for embedded workspaces
An embedded workspace uses the default service quotas of the apps that it runs. For example, step-by-step guides run as chat contacts, so they use the chat quotas. For more information, see Enable step-by-step guides in Connect Customer and Connect Customer service quotas.
Troubleshoot an embedded workspace
| Issue | Likely cause | Fix |
|---|---|---|
The embedded workspace is blank. |
The domain of your website isn't an approved origin for your instance. The browser blocks the embedded workspace even though the request succeeds. |
Add the domain to Approved origins. For more information, see Step 1: Add your website domain to approved origins. |
The embedded workspace shows an error. |
The guide was removed from the workspace. |
Add the guide again, and then generate a new script. |
The workspace loads, but the language or theme is wrong. |
The |
On the Generate embeddable script page, choose a Language and Theme mode, and then choose Update script. Copy the updated script to your website. |