> ## Documentation Index
> Fetch the complete documentation index at: https://koreai-ai-for-process-dev.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Amazon Connect Integration with Agent AI Voice Via AWS Third Party Applications

This document describes the integration of Amazon Connect with Kore Agent AI - Voice using AWS third-party applications. This integration enables Amazon Connect to receive voice calls while Agent AI provides real-time support to agents. Audio streams from both the user and agent are captured and processed using Amazon Kinesis Video Streams. AWS Lambda functions manage transcription and token generation. Agent AI is embedded into the Amazon Connect agent workspace to deliver AI-powered assistance such as [Agentic Copilot](./../../configuration/linked-services.md#agentic-configurations), [Next Best Action](./../../agent-experience/agent-assist-widget-v3.md), [Agent Coaching](./../../agent-experience/agent-realtime-coaching.md), [Agent Playbook](./../../agent-experience/playbook.md), [sentiment analysis](./../../agent-experience/agent-assist-widget-v3.md), [EOC Summary](./../../agent-experience/agent-assist-widget-v3.md#assist-tab), and more throughout the conversation.

## High-level architecture

<img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/architecture-diagram-1.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=ea4303a4a135597e7e8e1eb909168723" alt="architecture-diagram" width="842" height="527" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/architecture-diagram-1.png" />

## Prerequisites

* Amazon Connect instance with admin privileges.
* Kore Agent AI account.
* Basic know-how of Amazon Connect.
* Ability to receive voice calls on Amazon Connect agent desktop.
* AWS Lambda
* An account associated with the AWS Client ID and Secret with Read permissions to Amazon Kinesis Streams.
* Transcription trigger, a microservice that extracts the required parameters from the request body and generates the KVS Processing executable as a separate process with the parameters (like Contact Details, Credentials, and Voice Gateway).
* The **AgentAssist third-party application** created in Amazon Connect using AWS Third-party Applications.

## Integration Setup Guide

* [Amazon Connect Integration with Agent AI Voice Via AWS Third Party Applications](#amazon-connect-integration-with-agent-ai-voice-via-aws-third-party-applications)
  * [High-level architecture](#high-level-architecture)
  * [Prerequisites](#prerequisites)
  * [Integration Setup Guide](#integration-setup-guide)
    * [Kore Agent AI](#kore-agent-ai)
    * [AWS Lambda](#aws-lambda)
      * [First Function: KVS Trigger (Choose any other name)](#first-function-kvs-trigger-choose-any-other-name)
      * [Second Function: IFrame Token Generator (Choose any other name)](#second-function-iframe-token-generator-choose-any-other-name)
    * [AWS Connect Third Party Application Configuration](#aws-connect-third-party-application-configuration)
  * [Amazon Connect Security Profile Permissions](#amazon-connect-security-profile-permissions)
  * [Amazon Connect](#amazon-connect)
    * [Configuring Amazon Connect Instance](#configuring-amazon-connect-instance)
    * [Configuring Amazon Connect Contact Flow](#configuring-amazon-connect-contact-flow)
    * [Attaching Contact Flow to Phone Number](#attaching-contact-flow-to-phone-number)
  * [Test Your Integration](#test-your-integration)
  * [KVSQueueFlow.json](#kvsqueueflowjson)

### Kore Agent AI

To onboard the Kore Agent AI account and create dialog tasks, refer to [About Agent AI](../../about-agent-ai.md).

Two configurations are needed from Agent AI:

* Web/Mobile Client - JWT App Details
* SIP Trunk Configuration

### AWS Lambda

#### First Function: KVS Trigger (Choose any other name)

This function retrieves call stream metadata and AWS credentials from the environment, generates a credential set (SessionToken, AccessKeyId, SecretAccessKey) for KVS access, and triggers the Transcriber to send transcripts to the Kore AI Agent with the current Conversation ID.

1. Download the Lambda [from here](https://github.com/Koredotcom/korecc-twilio/raw/master/AmazonConnect/lambdas/KVS_Trigger.zip) and upload to the function you create.

2. Go to **Create function**.

3. Enter a name in the **Function name** field.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/create-function-2.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=4f14f7f94a0d04f381458c019efb7504" alt="create-function" width="2048" height="1063" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/create-function-2.png" />

4. Go to **Upload from**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/umQLh4W1pBSW3KIn/ai-for-service/agentai/integration/amazon-connect-voice/images/upload-from-3.png?fit=max&auto=format&n=umQLh4W1pBSW3KIn&q=85&s=77dc4f815053a2838cc01a724848d9c7" alt="upload-from" width="2048" height="1063" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/upload-from-3.png" />

   1. Upload the **Lambda** zipped file.
   2. Click **Save**.
   3. Go to **Runtime settings**.
   4. Click **Edit** and change the **Handler** name from **index.handler** to **kvs\_trigger.handler**.
      <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/runtime-settings-4.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=09b7a5dad0c93a247980c670e82083e5" alt="runtime-settings" width="2048" height="296" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/runtime-settings-4.png" />

5. Go to **Configuration** > **Environment variables**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/general-configuration-5.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=a3c22c7b27846ba39847349854155c36" alt="general-configuration" width="2048" height="468" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/general-configuration-5.png" />

6. Create the following environment variables within the Lambda:
   * **kvsAccessKeyId** - AWS Client ID
   * **kvsSecretAccessKey** - AWS Client Secret
   * **region** - add your AWS Region
   * **transcriberURL** - `https://agentassist.kore.ai/integrations/amzn/voice/`
   * For regions other than **US-prod**, replace the above domain with your Agent AI domain.

**Steps to get the AWS Client ID and Secret**

1. Ensure the account associated with the AWS Client ID and Secret has Read permissions to Amazon KVS Kinesis Streams.

2. Get your AWS Client ID and Secret from IAM:

   1. Go to **IAM** > **Users**.
   2. Click **Users** > **Security credentials** tab.
   3. Click **Create access key**.
   4. Select **Use case** as **Application running on an AWS compute service**.
   5. Click **next**.
   6. Enter a description tag, and then click **create access key**.
      <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/retrieve-access-keys-6.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=79eda563e10bf046d229a86c436b513b" alt="retrieve-access-keys" width="2048" height="982" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/retrieve-access-keys-6.png" />

3. The final configuration should appear like the following image:
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/environment-variables-7.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=0246493fb27d777814d5971768073ecf" alt="environment-variables" width="1745" height="664" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/environment-variables-7.png" />

#### Second Function: IFrame Token Generator (Choose any other name)

This function generates the Kore Agent AI IFrame widget token to display properly within the Amazon Connect agent workspace. Download the Lambda from [here](https://github.com/Koredotcom/korecc-twilio/raw/master/AmazonConnect/lambdas/Kore.ai_Token_Generator.zip) and upload this function on Lambda.

### AWS Connect Third Party Application Configuration

This includes the Kore Agent AI widget that renders within the Amazon Connect Agent Workspace with the context of the current conversation.

1. Go to **Amazon Connect** > **Third-party applications**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/third-party-applications-8.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=14868e42f97c33998df3b175191b1d5d" alt="third-party-applications" width="803" height="448" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/third-party-applications-8.png" />

2. Click **Add application**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/add-application-9.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=3ddc4d781e496882efef76b3d0fa0394" alt="add-application" width="1169" height="467" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/add-application-9.png" />

3. Enter a **Display name** for your app - for example, **Kore.ai AgentAssist Application**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/add-display-name-10.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=8501ed590c64d0b938945796fd839666" alt="add-display-name" width="914" height="587" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/add-display-name-10.png" />

4. Enter a **Namespace** for the app (for example, **kore.ai-example-ns**).
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/name-space-11.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=d8bada03b35098ea4631d6474fbade4b" alt="name-space" width="926" height="590" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/name-space-11.png" />

5. Enter [https://agentassist.kore.ai/integrations/amzn/tpa-voice/](https://agentassist.kore.ai/integrations/amzn/tpa-voice/) in the **Access URL** field.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/access-url-field-12.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=c56cdb0d00be9339d030c911b3612ccd" alt="access-url-field" width="687" height="515" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/access-url-field-12.png" />

6. Select all the instances that you want to enable AgentAssist for in the **Instance association - optional** field.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/instance-association-13.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=62a98a599abad38ae392f420206962df" alt="instance-association" width="796" height="461" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/instance-association-13.png" />

<Note>Third Party Apps are not supported for SAML based Amazon Connect instances. To use Kore Agent AI with SAML based Amazon Connect Instances, refer to [this doc](https://docs.kore.ai/agentassist/integration/amazon-connect-with-agentassist-voice-installation-guide/).</Note>

7. Click **Add application**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/add-application-14.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=a1582cee6dd2fe590d826919992e245a" alt="add-application" width="761" height="403" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/add-application-14.png" />

## Amazon Connect Security Profile Permissions

To view and use the Agent AI widget in the Amazon Connect Agent workspace, enable the **AgentAssist** application in the agent's security profile. If you don't assign this permission, the widget doesn't load even if the third-party application is created and associated with the Amazon Connect instance.

### Steps to enable the security profile permissions

1. Sign in to **Amazon Connect Admin Console**.
2. Navigate to **Users** > **Security Profiles**.
3. Open the relevant security profile (for example, **Agent** or **Admin**).
4. Scroll to the **Agent applications** section.
5. Ensure the **Agent applications** > **KoreAgentAssist** permission is enabled.
6. Save the security profile.
7. Make sure this security profile is assigned to the agent.

<Note>Only the users whose security profile includes **KoreAgentAssist** can see the Agent AI widget in the Agent workspace. This permission must be added **per security profile**, not **per user**.</Note>

8. If agents report that the Agent AI widget is not visible, verify the following:
   * Correct **assigned security profile**
   * **KoreAgentAssist** is enabled under **Agent applications**
   * **Agent** or **Admin** roles are assigned, and the required permission is present.

## Amazon Connect

### Configuring Amazon Connect Instance

1. Select your **Amazon Connect** instance. (To create a new instance, follow [Create an Amazon Connect instance](https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-instances.html).)
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/amazon-connect-instance-15.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=47ccad9b024c57c59ee29471ec82e725" alt="amazon-connect-instance" width="1138" height="407" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/amazon-connect-instance-15.png" />

2. Click **Data storage**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/data-storage-16.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=c55d071d54a127995c6e511e45699ce5" alt="data-storage" width="687" height="379" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/data-storage-16.png" />

3. Click **Edit** next to **Live media streaming**. Here, you must create instances of Kinesis Video Streams.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/live-media-streaming-edit-17.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=7cba6e8ebf5c25c29cadf2af1fb59055" alt="live-media-streaming-edit" width="565" height="108" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/live-media-streaming-edit-17.png" />

4. Add an appropriate **Prefix** for the **Kinesis Video Streams**, and select an **AWS Key Management Service**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/live-media-streaming-18.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=4065d5146780139895b85f1138d56a45" alt="live-media-streaming" width="570" height="761" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/live-media-streaming-18.png" />

5. Set an appropriate **Data retention period** - 1 hour should be enough for Kore.ai AgentAssist use cases.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/data-retention-period-19.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=468b966d8c4ca4b5a91acd7650db8374" alt="data-retention-period" width="1102" height="318" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/data-retention-period-19.png" />

6. Click **Save**.

7. Click **Data streaming**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/data-streaming-20.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=120c9607183bd6732d2f9164c7fcf009" alt="data-streaming" width="830" height="360" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/data-streaming-20.png" />

8. Select the **Enable data streaming** checkbox.

9. Select **Kinesis Stream**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/kinesis-stream-21.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=74b4911d2f06ce231ea660109cab66f9" alt="kinesis-stream" width="1139" height="448" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/kinesis-stream-21.png" />

10. Click **Create a new Kinesis Stream** for this application, or select an existing one from the dropdown list. You can use the same stream for **Contact Trace Records (CTRs)** and **Agent Events**.
    <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/create-kinesis-stream-22.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=a1f3b9f676656e2e7c50429cfb03d882" alt="create-kinesis-stream" width="629" height="450" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/create-kinesis-stream-22.png" />

11. Click **Save.**

12. Click **Flows**.
    <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/click-flows-23.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=18ba9340cf28bee2fbbb0d2def3a02d4" alt="click-flows" width="670" height="442" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/click-flows-23.png" />

13. Click **Choose an option** under **AWS Lambda**.
    <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/aws-lambda-option-24.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=c0c634b103fa6918bc154563595f9ee9" alt="aws-lambda-option" width="957" height="317" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/aws-lambda-option-24.png" />

14. Select **KVS Trigger Lambda** from the dropdown list.
    <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/kvs-trigger-lambda-25.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=e2a86a876f4a13ccdae48dc2ed075024" alt="kvs-trigger-lambda" width="1015" height="420" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/kvs-trigger-lambda-25.png" />

15. Click **Add Lambda Function**.
    <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/add-lambda-function-26.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=a44f3ead623d07f4661b6f17dcbca795" alt="add-lambda-function" width="846" height="347" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/add-lambda-function-26.png" />

16. Follow the above two steps for the IFrame Token Generator Lambda.

### Configuring Amazon Connect Contact Flow

1. Sign in to your **Amazon Connect Instance**.

2. Click **Flows**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/flows-amazon-connect-27.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=0b9c60deb78d48fdb3b5af3a0ca9b63f" alt="flows-amazon-connect" width="831" height="477" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/flows-amazon-connect-27.png" />

3. Click **Create flow**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/create-flow-28.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=82c95ffddb00317408467a640e0bcefc" alt="create-flow" width="1498" height="324" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/create-flow-28.png" />

4. Click the **dropdown list** icon.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/dropdown-list-icon-29.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=3915b200907df69ffb50d49dcbc02da3" alt="dropdown-list-icon" width="622" height="185" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/dropdown-list-icon-29.png" />

5. Click **Import**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/click-import-30.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=299bf65b6f1400a8c1080f2216f7919a" alt="click-import" width="1457" height="227" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/click-import-30.png" />

6. Select **KoreAgentAssist.json** from the file upload menu. You can download it from [here](https://raw.githubusercontent.com/Koredotcom/korecc-twilio/master/AmazonConnect/flows/voice/KoreAgentAssist.json).
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/kore-agent-assist-json-31.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=a55586aa31a1ce46c3f056e58de10954" alt="kore-agent-assist-json" width="760" height="357" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/kore-agent-assist-json-31.png" />

7. Click **Import**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/click-import-32.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=75920ba04e4613d2082b6bafba4bf0e7" alt="click-import" width="716" height="383" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/click-import-32.png" />

8. Click **Set contact attributes**, and enter the required fields:
   * **BotID**: Add your Agent AI Bot ID created on Kore UXO Platform.

   * **ClientId**: Add your Agent AI Client ID created on Kore UXO Platform.

   * **ClientSecret**: Add your Agent AI Client Secret created on Kore UXO Platform.

   * **Language**: Agent AI loads in English (en) by default. To load the widget in another language, pass the **Language contact** attribute in the contact flow.

   * **sipUri**: Add `sip:[XXXX@savg-us-prod-sbc-in-nlb-0d9a4c651955ff47.elb.us-east-1.amazonaws.com](mailto:XXXX@savg-us-prod-sbc-in-nlb-0d9a4c651955ff47.elb.us-east-1.amazonaws.com)` and replace **XXXX** with your SIPREC Configuration of Agent AI.

     To get the SIP URI from [Kore](https://platform.kore.ai/):

     1. Go to **Agent AI** > **Flows & Channels** > **Voice Gateway**.

     2. Click **SIP Numbers** > **Configure SIP Trunk**.

     3. Select **Agent AI**, under the **Product Selection** section.

     4. Enter \[172.23.12.0/24,172.23.13.0/24] in the **List of IP Address** field, for the US region.
        <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/configure-sip-trunk.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=841ec0bf4a0d3560489a8a578f11f0c1" alt="configure-sip-trunk" width="906" height="868" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/configure-sip-trunk.png" />

     5. Copy the **SIP URI** and paste inside the **contact attributes sipUri** field inside Amazon Connect flow.

   * **agentassistUrl**: Add your **Agent AI URL** created on Kore UXO Platform.

   * **accountId**: Add your Agent AI **Account ID** created on Kore UXO Platform.
     To get the **agentassistURL** and **accountID** values:
     1. Go to **Agent AI** > **Flows & Channels**.
     2. Click **Digital** > **Web/Mobile Client**.
     3. Click to expand the **JWT App Details** section.
        <img src="https://mintcdn.com/koreai-ai-for-process-dev/umQLh4W1pBSW3KIn/ai-for-service/agentai/integration/amazon-connect-voice/images/web-mobile-client.png?fit=max&auto=format&n=umQLh4W1pBSW3KIn&q=85&s=2d926ad03cb264dcd8c30c8d1ebb29d0" alt="web-mobile-client" width="687" height="894" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/web-mobile-client.png" />

   * **wssUrl**: Add **wss\://savg-webserver.kore.ai**

     <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/set-contact-attributes-33.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=d03855137e139e6470421e1177623c93" alt="set-contact-attributes" width="658" height="916" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/set-contact-attributes-33.png" />

9. Click **Save**.

10. Click **Start Stream and Transcription in Kore** Lambda.
    <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/start-stream-and-transcription-kore-lambda-34.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=8b14b33d0b4051452faa14b183fc8909" alt="start-stream-and-transcription-kore-lambda" width="498" height="912" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/start-stream-and-transcription-kore-lambda-34.png" />

11. Select your **Trigger Lambda Function** from the dropdown list.

12. Click **Save**.

13. Click **Kore Token Generator for TPA** Lambda.

14. Select your **IFrame token generation** Lambda.
    <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/iframe-token-generation-lambda-35.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=6182781df8a48775d11e9e9982dc4e36" alt="iframe-token-generation-lambda" width="501" height="458" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/iframe-token-generation-lambda-35.png" />

15. Click **Save**.

16. For **Transfer to Flow**, select a flow you want to move the user to. For example, save the following JSON in a file, import this flow to **Flows**, and add **Queue** details for routing: [KVSQueueFlow.json](#kvsqueueflowjson).

17. To use agent dispositions, configure the **Set Event Flow** block with **Disconnect flow for Agent UI** hook by importing [this flow](https://raw.githubusercontent.com/Koredotcom/korecc-twilio/master/AmazonConnect/flows/voice/DispositionFlow.json) and selecting it. If not, you can delete the block and connect the remaining blocks to the disconnect block.

<Note>The disposition saving logic is at your discretion. Implement as per your use case. Some examples are:</Note>

> * Use a Lambda to store it within a document database.
> * Pass the data via a webhook to a third-party CRM.

<img src="https://mintcdn.com/koreai-ai-for-process-dev/umQLh4W1pBSW3KIn/ai-for-service/agentai/integration/amazon-connect-voice/images/transfer-to-flow-36.png?fit=max&auto=format&n=umQLh4W1pBSW3KIn&q=85&s=10894debe2fdba6c4a1ee06e54d5dbd0" alt="transfer-to-flow" width="1469" height="798" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/transfer-to-flow-36.png" />

18. Click **Save**, and publish the flow.
    <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/save-publish-flow-37.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=1fc9e6c9acb0569b35f632974a24923d" alt="save-publish-flow" width="558" height="259" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/save-publish-flow-37.png" />

### Attaching Contact Flow to Phone Number

1. Click **Channels** > **Phone numbers**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/channel-phone-number-38.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=5165444f23092342c5c921e37f7dc596" alt="channel-phone-number" width="625" height="432" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/channel-phone-number-38.png" />

2. Select the **Phone Number** to attach to the flow. If you don't have a number, go through [How to get an Amazon Connect phone number in your current country](https://docs.aws.amazon.com/connect/latest/adminguide/get-connect-number.html) to claim a phone number.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/select-phone-number-39.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=5abcae9e0bd49eef24927e2ea1e43d97" alt="select-phone-number" width="1523" height="446" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/select-phone-number-39.png" />

3. Click the dropdown list to select the **Contact flow**.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/select-contact-flow-40.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=b0db2dbfa5a16dc3f87d7cd9aa2b8854" alt="select-contact-flow" width="838" height="141" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/select-contact-flow-40.png" />

4. Click the **AgentAssist flow** you created.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/click-created-flow-41.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=75764479b9a5b48883b1f86479b07cae" alt="click-created-flow" width="854" height="437" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/click-created-flow-41.png" />

5. Click **Save.**

## Test Your Integration

1. Open **Agent Workspace** from the home screen of your **Amazon Connect** instance.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/agent-workspace-42.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=47725e58b67f485caee3525dccf70148" alt="agent-workspace" width="1841" height="929" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/agent-workspace-42.png" />

2. Change the agent status to **Available**. All the third-party applications created in the earlier steps will be visible on the right side under the **Apps** dropdown.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/available-status-43.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=296f131b672e03f625f829c40957b30f" alt="available-status" width="1186" height="807" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/available-status-43.png" />

3. Call the **Amazon Connect** number. Once the incoming call lands into the agent desktop, accept it.

4. Click the **Apps** section, and open the third-party application created earlier.
   <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/apps-third-party-44.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=14adaa48fd6193162b31621496eed46f" alt="apps-third-party" width="1916" height="1008" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/apps-third-party-44.png" />

   * The **Agent AI widget** renders on the right side of the screen.
     <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/agent-ai-widget-45.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=cfef8ccbdd2e52828dfc7b465cdd9f04" alt="agent-ai-widget" width="1549" height="998" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/agent-ai-widget-45.png" />

   * The Agent AI widget listens to all the user and agent conversation, and the transcript is visible on the **Transcript** tab of the widget.
     <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/transcript-tab-46.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=a8359e49e751e8aedfdffe453626267a" alt="transcript-tab" width="1551" height="998" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/transcript-tab-46.png" />

   * Based on the **use case/dialog task** configuration in your Agent AI portal, real-time suggestions appear on the **Assist Home** tab of the widget from the user message in the transcription.
     <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/assist-home-tab-47.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=22493ecc6436ff313229e3680e11d1ec" alt="assist-home-tab" width="1558" height="1003" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/assist-home-tab-47.png" />

   * Once the call is disconnected, a call summary appears. The agent can modify the summary or copy it to save it into the CRM.
     <img src="https://mintcdn.com/koreai-ai-for-process-dev/mOwlrelwqYFBG4JM/ai-for-service/agentai/integration/amazon-connect-voice/images/call-summary-48.png?fit=max&auto=format&n=mOwlrelwqYFBG4JM&q=85&s=6981f06655556bb2f69879288297b104" alt="call-summary" width="1558" height="1006" data-path="ai-for-service/agentai/integration/amazon-connect-voice/images/call-summary-48.png" />

## KVSQueueFlow\.json

```
{
    "Version": "2019-10-30",
    "StartAction": "368dcb0e-e4c5-4301-bad0-6ec9cb4xxxxx",
    "Metadata": {
        "entryPointPosition": {
            "x": 48,
            "y": 99
        },
        "ActionMetadata": {
            "f8cb2217-5e95-4ca4-a2d1-1cfdc3exxxxx": {
                "position": {
                    "x": 1186,
                    "y": 287
                }
            },
            "06ffce3e-77e0-42c7-b872-8fa73b8xxxxx": {
                "position": {
                    "x": 910,
                    "y": 96
                }
            },
            "368dcb0e-e4c5-4301-bad0-6ec9cb4xxxxx": {
                "position": {
                    "x": 186,
                    "y": 93
                },
                "parameters": {
                    "QueueId": {
                        "displayName": "BasicQueue"
                    }
                },
                "queue": {
                    "text": "BasicQueue"
                }
            },
            "6992aaaf-4140-4f3f-beb5-a638d7fxxxxx": {
                "position": {
                    "x": 520,
                    "y": 79
                },
                "parameters": {
                    "EventHooks": {
                        "DisconnectAgentUI": {
                            "displayName": "Disposition Flow"
                        }
                    }
                }
            }
        },
        "Annotations": [],
        "name": "KVSQueueFlow",
        "description": "",
        "type": "contactFlow",
        "status": "published",
        "hash": {}
    },
    "Actions": [
        {
            "Parameters": {},
            "Identifier": "f8cb2217-5e95-4ca4-a2d1-xxxxx3e02dce",
            "Type": "DisconnectParticipant",
            "Transitions": {}
        },
        {
            "Parameters": {},
            "Identifier": "06ffce3e-77e0-42c7-b872-8fa73b8xxxxx",
            "Type": "TransferContactToQueue",
            "Transitions": {
                "NextAction": "f8cb2217-5e95-4ca4-a2d1-1cfdc3exxxxx",
                "Errors": [
                    {
                        "NextAction": "f8cb2217-5e95-4ca4-a2d1-1cfdc3exxxxx",
                        "ErrorType": "QueueAtCapacity"
                    },
                    {
                        "NextAction": "f8cb2217-5e95-4ca4-a2d1-1cfdc3exxxxx",
                        "ErrorType": "NoMatchingError"
                    }
                ]
            }
        },
        {
            "Parameters": {
                "QueueId": "arn:aws:connect:us-east-1:2748635xxxxx:instance/97c94b3a-7d46-4680-b2ee-ae23086xxxxx/queue/e7c6d05e-b7f2-43d6-abe9-aa861e2xxxxx"
            },
            "Identifier": "368dcb0e-e4c5-4301-bad0-6ec9cb4xxxxx",
            "Type": "UpdateContactTargetQueue",
            "Transitions": {
                "NextAction": "6992aaaf-4140-4f3f-beb5-a638d7fxxxxx",
                "Errors": [
                    {
                        "NextAction": "6992aaaf-4140-4f3f-beb5-a638d7fxxxxx",
                        "ErrorType": "NoMatchingError"
                    }
                ]
            }
        },
        {
            "Parameters": {
                "EventHooks": {
                    "DisconnectAgentUI": "arn:aws:connect:us-east-1:2748635xxxxx:instance/97c94b3a-7d46-4680-b2ee-ae23086xxxxx/contact-flow/2649a757-5612-4e81-8794-56c760bxxxxx"
                }
            },
            "Identifier": "6992aaaf-4140-4f3f-beb5-a638d7fxxxxx",
            "Type": "UpdateContactEventHooks",
            "Transitions": {
                "NextAction": "06ffce3e-77e0-42c7-b872-8fa73b8xxxxx",
                "Errors": [
                    {
                        "NextAction": "f8cb2217-5e95-4ca4-a2d1-1cfdc3exxxxx",
                        "ErrorType": "NoMatchingError"
                    }
                ]
            }
        }
    ]
}
```


Built with [Mintlify](https://mintlify.com).