This is a react based application for the multilingual contact center solution that helps call centres overcome language barriers between call center agents and customers. Using AWS services like Amazon Connect, Amazon Transcribe, Amazon Translate, and Amazon Polly, this solution provides near real-time translation capabilities, allowing agents to effectively communicate with customers who speak different languages.
This solution provides near real-time translation chat support through Amazon Connect, Amazon Transcribe, and serverless code through AWS Lambda. Translations that would take hours to complete manually are performed in moments and read back, in life-like speech, and in a member’s chosen language through Amazon Polly. This solution is designed to be a cost-effective, scalable, and secure solution for organizations that need to provide multilingual support to their customers.
The architectural diagram for AWS Backend is:
For the prerequisites, we need to have the following:
- Node.js and npm
- React and Vite
- AWS SDK for JavaScript
- Material UI
- Amazon Connect Streams
For deploying the backend, we need to follow the steps as provided in this blog: Building a multilingual contact center
-> First we need to deploy the backend as shown in the backend prerequisites, then use the resources such as API to add to the Frontend.
-> Clone the repo and navigate to the frontend directory:
To run the frontend locally, follow the steps:
-
We need to create https certificate and save it.
-
Allowing Origins for Amazon Connect:
- Go to AWS console and go to the Amazon Connect service.
- Go to the "Approved origins" section
- Click on the "Add domain" button
- Add the domain name of the frontend application such as "https://localhost:3000" (if that is the one you will be using to run the frontend locally or come back after running the app with https locally)
-
Editing CORS policies for API Gateway:
- Go to the AWS console and go to the API Gateway service.
- Go to the "mlcc-placecall-api" API and click on the "Enable CORS" button.
- Edit the "Access-Control-Allow-Origin" to add the domain name of the frontend application such as "https://localhost:3000" (if that is the one you will be using to run the frontend locally or come back after running the app with https locally) or for testing purposes, you can add "*".
-
Editing CORS policy for the Lambda function for "mlcc-Transcribe-Polly":
- Go to the AWS console and go to the Lambda service.
- Go to the "mlcc-Transcribe-Polly" Lambda function.
- Edit the code to edit the "Access-Control-Allow-Origin" to add the domain name of the frontend application or for testing purposes, you can add "*".
'headers': {
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Origin': "*",
'Access-Control-Allow-Methods': 'OPTIONS,POST,GET'
}
-
Create a .env file in the root directory of the frontend and add the following:
- VITE_WS_ENDPOINT= "websocket endpoint of the API Gateway" - VITE_CCP_URL= "Amazon Connect CCP URL" - VITE_AWS_REGION= "AWS Region" - VITE_ALLOWED_ORIGIN_1= "Allowed Origin 1 for your application that you added for Amazon Connect" - VITE_ALLOWED_ORIGIN_2= "Allowed Origin 2 for your application that you added for Amazon Connect"
-
In the
vite.config.js
file, add the certificate Key and Certificate Path. -
In the
/components/inputTextForTranslation/InputTextForTranslation.jsx
file, add the API Gateway URL for the "mlcc-placecall-api" REST API. -
Run the following command to install the dependencies:
npm install
npm run dev
AWS Amplify provides a fully managed service for deploying and hosting your React applications. Follow these steps to deploy your application:
- AWS Account
- GitHub, GitLab, BitBucket, or AWS CodeCommit repository with your code
- Administrator access to your AWS account
Ensure your code is pushed to a Git repository (GitHub, GitLab, BitBucket, or AWS CodeCommit).
- Sign in to the AWS Management Console and navigate to AWS Amplify
- Click Create app
- Select Host web app
- Choose your Git provider and connect to your repository
- Authorize AWS Amplify to access your repository
- Select the repository and branch you want to deploy
In the build settings, add the environment variables from your .env file:
- VITE_WS_ENDPOINT= "websocket endpoint of the API Gateway"
- VITE_CCP_URL= "Amazon Connect CCP URL"
- VITE_AWS_REGION= "AWS Region"
- VITE_ALLOWED_ORIGIN_1= "Allowed Origin 1 for your application that you added for Amazon Connect"
- VITE_ALLOWED_ORIGIN_2= "Allowed Origin 2 for your application that you added for Amazon Connect"
After deployment, you need to update your CORS settings and Amazon Connect approved origins:
- Add your Amplify app domain (e.g., https://main.XXXXXXXXXX.amplifyapp.com) to Amazon Connect approved origins
- Update API Gateway CORS settings to include your Amplify app domain
- Update Lambda function CORS headers to include your Amplify app domain
Users can Log-in to the application in a new window that opens up using their Amazon Connect credentials. When call is received on the number assigned in the Amazon Connect, the call will be displayed on the application.
- Real Time Transcription: As the call starts, it is transcribed in real time in the preferred language to the agent on the right section of the screen.
- Real Time Text Translation: The agent can type in their preferred language and click on the "Translate" button. The text will be translated to the language of the customer. The translated text is then converted to speech using Amazon Polly and played to the customer.
- Entities: The entities such as location, date, organization etc. in the text are shown at the tool tip, in the entities section.
- Sentiment Analysis: The sentiment of the customer is analyzed and shown in the sentiment section with emojis.
Full-Stack Developer: Loveneet Singh
UI/UX Designer, Front-end Developer: Lahari Shakthi Arun
UI/UX Designer: Saran Nithissh Ramesh