# Multi-party Chat Feature **Scope:**: `AGENT` chat sessions, Custom CCP **Requires**: - `amazon-connect-streamsjs@>=2.18.1` - `amazon-connect-chatjs@>=v1.4.0` Multi-Party (Conference) Chat is currently supported in Amazon Connect Chat. This feature utilizes **Quick Connects**, and [StreamsJS](https://github.com/amazon-connect/amazon-connect-streams) provides the methods to manage this. ### Additional Details - __StreamsJS__ (`amazon-connect-streams`) - Provides core functionality for managing contact interactions - Offers the `contact.addParticipant()` method for triggering **Quick Connects** - Handles contact lifecycle events (accept, connect, etc.) - __ChatJS__ (`amazon-connect-chatjs`) - Manages chat-specific interactions - Provides methods for sending messages, managing chat sessions - Handles chat-specific events like typing indicators, message delivery - **Participant Limit**: Up to 6 participants per chat session - 1 customer - 1 primary agent - 4 additional agents - **Availability**: - CCPv2 (Contact Control Panel v2) - Agent workspace - Custom CCPs using Amazon Connect StreamsJS - **Limitations**: - Read/delivered receipts are not supported - Not available in AWS GovCloud (US-West) Region ## Implementing Amazon Connect Multi-Party Chat With StreamsJS and ChatJS ## 1. Enable the Multi-Party Chat Feature Follow these steps to activate multi-party chat functionality in your Amazon Connect instance: 1. Log in to the AWS Management Console 2. Select your Amazon Connect instance 3. Navigate to **Telephony** in the left navigation menu 4. Locate the **Enhanced contact monitoring capabilities** section 5. Check the box for **Enable Multi-Party Chats and Enhanced Monitoring for Chat** 6. Click **Save changes** ![Multi-Party Chat Configuration](https://github.com/user-attachments/assets/101686ae-9c92-4ec5-8424-718c05b6e7af) > **Note**: Enabling this feature allows for more complex chat routing and monitoring capabilities within your contact center. ## 2. Configure Profiles and Quick Connects Configuring multi-party chat requires careful setup of user profiles, routing, and quick connects: ### 2.1 Create Quick Connect for Agent Transfer 1. Access Amazon Connect admin console 2. Navigate to **Routing** > **Quick Connects** 3. Click **Add new Quick Connect** 4. Configure the Quick Connect with these details: - **Name**: Descriptive transfer name (e.g., "transfer-to-agent-1") - **Type**: Select "User" - **User**: Choose the target agent's username - **Contact Flow**: Select "Default agent transfer" Image Image ### 2.2 Set Up Security and Routing Profiles 1. Go to **Users** > **User management** 2. Edit the target agent's profile 3. Verify and configure: - **Security Profile**: * Ensure "Quick Connects" permission is enabled * Confirm routing capabilities - **Routing Profile**: * Assign to "Basic Routing Profile" or appropriate profile Image ### 2.3 Update Queue Configuration 1. Navigate to **Routing** > **Queues** 2. Select the relevant queue (e.g., **Basic Queue**) 3. Configure Quick Connect settings: - Add the newly created Quick Connect - Verify transfer and routing permissions 4. Click **Save changes** ![Queue Settings](https://github.com/user-attachments/assets/91c6c567-3621-421d-8e06-7b12bc0f6e1c) ## 3. (Optional) Test End-to-end Multi-Party Chat Functionality Consult the official Amazon Connect multi-party chat documentation: https://docs.aws.amazon.com/connect/latest/adminguide/multi-party-chat.html https://github.com/user-attachments/assets/ecbc7a60-0737-480d-b381-169b6ca8eb51 ## 4. Get QuickConnect ARN When editing a Quick Connect in the Amazon Connect Admin console, the URL will have this format: ``` https://instance.my.connect.aws/transfer-dests/edit?id=asdfsadf-0f37-4056-9d50-d5512c2e2879 ``` To retrieve the **QuickConnect ARN**, you have two methods: 1. **Browser Method**: - Copy the `id` from the edit URL - Open this page in your browser: ``` https://instance.my.connect.aws/quick-connect-management/quick-connects/ ``` 2. **API Method**: - Use the [DescribeQuickConnect API](https://docs.aws.amazon.com/connect/latest/APIReference/API_DescribeQuickConnect.html) Example API Response: ```json { "QuickConnect": { "QuickConnectARN": "arn:aws:connect:us-west-2:123456789101:instance/.../transfer-destination/...", "QuickConnectId": "...", "Name": "Transfer-to-agent-1" } } ``` ## 5. StreamsJS Changes for the Agent Chat UI Build out the Agent Chat UI with StreamsJS and ChatJS by using the `contact.addParticipant()` method to dynamically add participants to an ongoing chat session. > Full method documentation: [Amazon Connect Streams GitHub](https://github.com/amazon-connect/amazon-connect-streams/blob/master/Documentation.md) ```diff // Initialize Connect CCP connect.core.initCCP({ containerDiv: 'containerDiv', ccpUrl: 'https://your-instance-name.awsapps.com/connect/ccp-v2/', loginPopup: true }); // Subscribe to contact events connect.contact(function(contact) { if (contact.getType() === connect.ContactType.CHAT) { // Automatically accept chat contact.accept(); + // Programmatically trigger the QuickConnect to add another agent to the chat + const endpoint = { + id: '98979-asdf-asdf-asdf-sadf', // QuickConnectId + endpointARN: "arn:aws:connect:us-west-2:12345678901:instance/asdf-asfd-asdf-1234-asdf/transfer-destination/98979-asdf-asdf-asdf-sadf", // QuickConnectARN + type: "agent", // IMPORTANT: Must be one of: phone_number, agent, queue + name: "Transfer-to-agent-2", // QuickConnect Name + }; + + // Add participant using StreamsJS + // Reference: https://github.com/amazon-connect/amazon-connect-streams/blob/master/src/index.d.ts#L2107 + contact.addParticipant(endpoint, { + success: () => { + console.log('Participant added successfully'); + }, + failure: (reason) => { + console.error('Failed to add participant:', reason); + } + }); } }); ``` ## Example Implementation Here's a working proof-of-concept file you can run locally, e.g. `http://localhost:8080/index.html` Before running the example, you must allow-list the domain to run on `localhost:PORT`. Follow these steps: 1. Login to your AWS Account 2. Navigate to the Amazon Connect console 3. Click on your instance name 4. Click the "Application integration" link on the left sidebar 5. Click "Add Origin" 6. Enter the domain URL: `http://localhost:8080` Image #### Code https://github.com/user-attachments/assets/a4c08c6d-7911-4b9b-8435-346981dcff45 ```bash node --version # >= v16.x npx live-server --port=8080 chatjs-streamsjs-multiparty-example.html ``` ```html Agent Chat UI [Amazon Connect]

Custom Agent Chat UI (ChatJS + StreamsJS)

```