MCPcopy Index your code
hub / github.com/amazon-connect/amazon-connect-chat-ui-examples

github.com/amazon-connect/amazon-connect-chat-ui-examples @v1.4.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.4.4 ↗ · + Follow
709 symbols 2,065 edges 107 files 24 documented · 3% updated 35d agov1.4.4 · 2025-04-21★ 1773 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Amazon Connect Chat UI Examples

This repo contains examples on how to implement the customer side of Amazon Connect chat. Please refer to the README under each solution to see the complete details as to what each solution does and how to deploy it.

New to Amazon Connect and looking to onboard with Chat/Messaging capabilities? Refer to the “Amazon Connect Chat Open Source Walkthrough” documentation. We have the following three approaches to get started:

Approaches

Option 1: Pre-built Amazon Connect Hosted Widget Snippet

Follow the Admin Guide Documentation: https://docs.aws.amazon.com/connect/latest/adminguide/add-chat-to-website.html

Add a chat widget to your website that is hosted by Amazon Connect. You can configure the chat widget in the Amazon Connect console: customize the font and colors, and secure the widget so that it can be launched only from your website. As a result, you will have a short code snippet that you add to your website, with latest version always live on your website.

<script type="text/javascript">
  (function(w, d, x, id){s=d.createElement('script');s.src='https://1234lbvr0vu.cloudfront.net/amazon-connect-chat-interface-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', '360f3075-asfd-asfd-asdf-asdf');

  amazon_connect('styles', { openChat: { color: '#ffffff', backgroundColor: '#07b62a'}, closeChat: { color: '#ffffff', backgroundColor: '#07b62a'} });
  amazon_connect('snippetId', 'asdf1234asdf1234adsf1234=');
  amazon_connect('supportedMessagingContentTypes', [ 'text/plain', 'text/markdown' ]);
</script>

Hosted Widget Snippet UI

Option 2: Hosted Widget Snippet Integrated Custom UI (S3 Bucket/CDN)

Fork the amazon-connect-chat-interface open source code, and follow steps listed in HostedSnippetCustomBundleFileSetup.md for a full setup walkthrough

Integrate a fully customized chat interface UI in the pre-built Hosted Widget, with all configurations available in the Connect Admin Console. The hosted widget can handle all of the logic to render the widget on your website and start chat sessions.

Host your own amazon-connect-chat-interface.js bundle file and provide the link in the widget snippet configuration.

<script type="text/javascript">
  (function(w, d, x, id){s=d.createElement('script');s.src='https://1234lbvr0vu.cloudfront.net/amazon-connect-chat-interface-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', '360f3075-asdf-asdf-asdf-sadfsadf1234');

  amazon_connect('styles', { openChat: { color: '#ffffff', backgroundColor: '#07b62a'}, closeChat: { color: '#ffffff', backgroundColor: '#07b62a'} });
  amazon_connect('snippetId', 'asdf1234asdf1234adsf1234=');
  amazon_connect('supportedMessagingContentTypes', [ 'text/plain', 'text/markdown' ]);
+ amazon_connect('customerChatInterfaceUrl', 'https://...'); # TODO: put in your link to amazon-connect-chat-interface.js
</script>

Host Widget Snippet Integrated Custom UI

Option 3: Customized Widget and Chat Interface UI (Self-Hosted)

Refer to the customChatWidget example code, and follow steps listed in CustomChatAndWidgetSelfHostedSetup.md for a full setup walkthrough

Fully customize the chat interface UI for your website, add a form to collect user info, and customize how the widget is rendered. Host and manage the bundle file yourself, importing it with a <script src="https://github.com/amazon-connect/amazon-connect-chat-ui-examples/raw/v1.4.4/amazon-connect-chat-interface.js"></script> tag.

Custom Widget Experience

NOTE: This approach requires a custom backend to invoke the Amazon Connect Public StartChatContact API. Refer to the startChatContactAPI CloudFormation Template to deploy an API Gateway proxy solution.

Custom Widget Experience Backend

Solutions

At the moment, these are the solutions in this repo:

  1. cloudformationTemplates/startChatContactAPI The Start Chat Contact API solution creates a simple API to start the chat from the customer side. Use this solution if you want to custom build your customer chat widget. There is also an example html file in this repo that shows you how to make subsequent calls to Chat JS to send messages between the customer and agent after the chat is started.
  2. cloudformationTemplates/urlPreviewForAsyncChat The Url preview for async chat solution is an enhancement of the Async Customer Chat solution, which presents URL previews in chat. For example, entering www.aws.com in the chat window will display a rich preview with an image of the website for a better experience. There is also an example html file in this repo that shows you how to make subsequent calls to Chat JS to send messages between the customer and agent after the chat is started.
  3. samTemplates/amazon-connect-interactive-messages-example Interactive messages in Amazon Connect Chat allow contact centers to provide personalized prompts and response options that customers can easily select from. This serverless application is a sample lambda function which implements Amazon Connect interactive message templates (lists, lists with images, and a time picker) as described in the AWS Contact Center blog post How to enable interactive messages in Amazon Connect chat.

  4. samTemplates/amazon-connect-interactive-messages-example-lex-v2 Interactive messages in Amazon Connect Chat allow contact centers to provide personalized prompts and response options that customers can easily select from. This serverless application is a sample lambda function which implements Amazon Connect interactive message templates (lists, lists with images, and a time picker).

  5. customChatWidget Custom Chat Widget for Amazon Connect, with a Chat Form that can be easily plugged into a webpage. This solution helps customers to have Amazon Connect Custom Chat Widget in their website, by applying simple configuration parameters. It also makes customizing the amazon-connect-interface.js file easier, and can be used as an easy way to host custom widget on a webpage.

  6. connectReactNativeChat React Native demo Chat application for Amazon Connect. This cross-platform solution implements basic Chat JS functionality and is fully customizable. Follow the provided documentation to build with amazon-connect-chatjs@^1.5.0.

  7. startChatContactAPILocalProxy Solution to run local proxy server for the Amazon Connect StartChatContact Public API. Can be used during local development when building a custom chat interface, prior to deploying a production CloudFormation chat backend.

  8. hostedWidgetCustomization Additional ways to configure the Amazon Connect Hosted Widget on your website and further personalize the branding. This sample code covers several common use cases for customizing the widget snippet code. Learn more

  9. mobileChatExamples These native mobile examples of the AWS Connect chat widget are designed for easy integration with a focus on customization. Out-of-the-box ready yet fully adaptable, they offer developers the perfect starting point for incorporating a chat feature that can be fine-tuned to any customer’s requirements.

Resources

Here are a few resources to help you implement chat in your contact center:

Enabling Chat in an Existing Amazon Connect Contact Center

If your instance was created before the release of the chat feature, here's an overview of what you need to do to enable chat, as well as what has changed.

  1. Because you have an existing instance, you'll need to enable chat testing mode to use the simulated environment we've provided for testing. Follow these steps:

    1. In Amazon Connect, choose Users, Security profiles.
    2. Select the security profile that you want update, such as Admin.
    3. Expand Numbers and flows.
    4. For Chat test mode choose Enable/Disable.
    5. Choose Save. Now people who are assigned to that security profile will be able to use the simulated chat experience.
      Note: Another option is to create a new security profile specifically for testing chat and assign testers to that profile. screenshot of enabling chat on a security profile
  2. Enable Chat in your Routing Profile. Go into your instance's website and go to the Routing Profiles section. Edit the Routing Profile for your agent and add the Basic Queue to the profile with the chat channel enabled. screenshot of enabling chat on a routing profile

  3. Your existing contacts flows will also work for chat! You just need to update them to specify how you want them to work. We've added the following action blocks:

    And updated these blocks for chat:

  4. Your metric reports and the contact trace records will now reflect chat as a channel. Note the following metrics:

    • Agent Activity: This metric used to be named Agent Status. Existing reports that used Agent Status as the column name will start using Agent Activity as the column name.
    • Availability: This metric has a new definition to account for chat. The change has no impact on metrics for voice calls.
    • Capacity: This is a new real-time metric.
    • Contact State: This metric has a few changes so the states are better aligned to what the agent sees in the updated CCP.

    Check out the Real-time Metrics Definitions and Historical Metrics Defini

Extension points exported contracts — how you extend this code

WidgetCloseListener (Interface)
(no doc)
mobileChatExamples/android-webview-sample/app/src/main/java/com/amazonaws/android_webview_sample/JSInterface.kt
ApiInterface (Interface)
(no doc)
mobileChatExamples/androidChatExample/app/src/main/java/com/blitz/androidchatexample/network/ApiInterface.kt
MessageContent (Interface)
(no doc)
mobileChatExamples/androidChatExample/app/src/main/java/com/blitz/androidchatexample/models/MessageContent.kt
InteractiveContent (Interface)
(no doc)
mobileChatExamples/androidChatExample/app/src/main/java/com/blitz/androidchatexample/models/MessageContent.kt

Core symbols most depended-on inside this repo

n
called by 153
customChatWidget/public/ACChat.js
r
called by 149
customChatWidget/public/ACChat.js
a
called by 96
customChatWidget/public/ACChat.js
i
called by 63
customChatWidget/public/ACChat.js
e
called by 54
customChatWidget/public/ACChat.js
o
called by 41
customChatWidget/public/ACChat.js
l
called by 28
customChatWidget/public/ACChat.js
on
called by 24
mobileChatExamples/connectReactNativeChat/src/components/ChatSession.js

Shape

Function 503
Method 149
Class 53
Interface 4

Languages

TypeScript79%
Kotlin21%

Modules by API surface

customChatWidget/public/ACChat.js366 symbols
mobileChatExamples/connectReactNativeChat/src/components/ChatSession.js66 symbols
mobileChatExamples/androidChatExample/app/src/main/java/com/blitz/androidchatexample/repository/WebSocketManager.kt17 symbols
mobileChatExamples/androidChatExample/app/src/main/java/com/blitz/androidchatexample/models/MessageContent.kt17 symbols
mobileChatExamples/androidChatExample/app/src/main/java/com/blitz/androidchatexample/viewmodel/ChatViewModel.kt15 symbols
mobileChatExamples/connectReactNativeChat/src/datamodel/Utils.js13 symbols
mobileChatExamples/android-webview-sample/app/src/main/java/com/amazonaws/android_webview_sample/WebviewFragment.kt12 symbols
mobileChatExamples/android-webview-sample/app/src/main/java/com/amazonaws/android_webview_sample/MainActivity.kt11 symbols
mobileChatExamples/androidChatExample/app/src/main/java/com/blitz/androidchatexample/repository/ChatRepository.kt9 symbols
mobileChatExamples/android-webview-sample/app/src/main/java/com/amazonaws/android_webview_sample/JSInterface.kt9 symbols
mobileChatExamples/connectReactNativeChat/src/components/ChatWrapper.js7 symbols
mobileChatExamples/androidChatExample/app/src/main/java/com/blitz/androidchatexample/MainActivity.kt7 symbols

For agents

$ claude mcp add amazon-connect-chat-ui-examples \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page