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

# Agent AI Integration with Genesys Cloud CX

Agent AI integration in Genesys supports multiple bots and queue-based functionality. This gives Genesys Cloud CX a flexible and scalable solution for improving agent efficiency and customer satisfaction across multiple departments. This guide explains how to set up the Agent AI widget in the Genesys environment.

<Note>This integration process also applies to the Genesys Desktop App.</Note>

## Definitions

| Section/Group                                                                                                                      | Key                                 | Definition                                                                                                                                                                                                                                                                                                                                                                                           | Reference                                                                                                                                                                                                 |
| ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Generate Oauth ID to enable Kore Services to Connect with Genesys<br />+<br />Create an Interaction Widget in Genesys for Agent AI | Agent AI URL                        | The domain of the Agent AI.                                                                                                                                                                                                                                                                                                                                                                          | - If it's AI for Service, refer to the [Getting Started](/ai-for-service/getting-started) doc and use an appropriate URL. <br />- If it's on-prem, the URL points to the origin where your Agent AI runs. |
|                                                                                                                                    | Client App                          | To use the Kore AI Agent SDK, you must create a client app to get the authentication credentials to communicate between the Kore AI Agent and Agent AI. The system supports only the default Client App.                                                                                                                                                                                             | [Adding the Web or Mobile Client Channel](/ai-for-service/channels/add-web-mobile-client#add-webmobile-client-channel)                                                                                    |
| Create an Interaction Widget in Genesys for Agent AI                                                                               | Custom Data / x\_passthru\_metadata | Use this to pass information to Kore AI Agent.                                                                                                                                                                                                                                                                                                                                                       |                                                                                                                                                                                                           |
| Capture AI Agent Information in Kore Data Table                                                                                    | Secure Custom Data / KvpConfig      | Use this to pass sensitive information to Kore AI Agent.                                                                                                                                                                                                                                                                                                                                             | [JSON Web Encryption](/ai-for-service/sdk/sdk-security#json-web-encryption-jwe)                                                                                                                           |
| Create an Interaction Widget in Genesys for Agent AI                                                                               | Interaction Widget                  | The Interaction Widget displays the Agent AI iframe within the Genesys Agent Desktop.                                                                                                                                                                                                                                                                                                                | [Set up an Interaction Widget Integration](https://help.mypurecloud.com/articles/set-up-an-interaction-widget-integration)                                                                                |
| Create an Interaction Widget in Genesys for Agent AI                                                                               | Interaction Widget URL params       | - `multibot=true` represents usage of new version of Agent AI integration that supports agent specific AI Agent.<br />- `x_metadata` - URL-encoded JSON containing the data that Kore Middleware service needs.<br />- `x_passthru_metadata` - Optional, can be JWE/JWT/base64/URL-encoded JSON stored as custom data.                                                                               | `x_metadata` JSON object structure:<br />`{"datatable":{"name":"<datatable name>","token":"<jwt token>","qDelimiter":"<Paste the special character used in the queue name>"}}`                            |
| Capture AI Agent Information in Kore Data Table                                                                                    | BotId                               | A unique identifier assigned to an AI Agent.                                                                                                                                                                                                                                                                                                                                                         | Agent AI > Flows & Channels > Digital > Web/Mobile Client > JWT App Details                                                                                                                               |
| Capture AI Agent Information in Kore Data Table                                                                                    | ClientId                            | An identifier provided to a client application.                                                                                                                                                                                                                                                                                                                                                      | Agent AI > Flows & Channels > Digital > Web/Mobile Client > JWT App Details                                                                                                                               |
| Capture AI Agent Information in Kore Data Table                                                                                    | ClientSecret                        | A secret key or password associated with the ClientId.                                                                                                                                                                                                                                                                                                                                               | Agent AI > Flows & Channels > Digital > Web/Mobile Client > JWT App Details                                                                                                                               |
| Capture AI Agent Information in Kore Data Table                                                                                    | AgentAssistWidgetURL                | URL that points to the Agent AI widget.<br />For example: `https://agentassist.kore.ai/koreagentassist-sdk-v3/UI/agentassist-iframe.html`                                                                                                                                                                                                                                                            | Agent AI > Flows & Channels > Digital > Web/Mobile Client > JWT App Details                                                                                                                               |
| Capture AI Agent Information in Kore Data Table                                                                                    | AudiohookEnabled                    | A setting or flag indicating whether Kore audio processing runs for the AI Agent.                                                                                                                                                                                                                                                                                                                    | Set to `true` to turn on Kore audio processing, or `false` to turn it off.                                                                                                                                |
| Capture AI Agent Information in Kore Data Table                                                                                    | QueueIdentifier                     | A unique identifier in the Data Table to fetch AI Agent details at run time.                                                                                                                                                                                                                                                                                                                         |                                                                                                                                                                                                           |
| Capture AI Agent Information in Kore Data Table                                                                                    | KvpConfig                           | The key-value pairs (KVPs) to include in SecureCustomData. JSON object containing the necessary keys and xpath (paths to locate the value in Genesys Conversation API result JSON object). [Genesys API Explorer](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-conversations--conversationId)<br />**Note:** Optional column. You need it to send secure custom data to Agent AI. | **Sample:**<br />`{`<br />"queueName": "participants\[0].queueName,"<br />"callStatus": "participants\[0].calls\[0].state"`}`                                                                             |
| Capture AI Agent Information in Kore Data Table                                                                                    | JWEPublicKey                        | Public key assigned to the Client App.                                                                                                                                                                                                                                                                                                                                                               | Agent AI > Flows & Channels > Digital > Web/Mobile Client > JWT App Details                                                                                                                               |
| Capture AI Agent Information in Kore Data Table                                                                                    | RSPrivatePem                        | The Private Key that corresponds to the Public Key supplied during the creation of a Client App using the RS256 or RS512 algorithm.                                                                                                                                                                                                                                                                  | **RSPrivatePemKey** is an optional column, and you need it only when the algorithm is RS256 or RS512.<br />(Not supported)                                                                                |
| Capture AI Agent Information in Kore Data Table                                                                                    | Algorithm                           | Algorithm assigned to the Client App.                                                                                                                                                                                                                                                                                                                                                                | The value must be HS256.                                                                                                                                                                                  |
| Install Audiohook for Voice Streaming                                                                                              | Voice Gateway                       | For the US region, value is `savg-webserver.kore.ai`.<br />For on-prem, refer to corresponding host.                                                                                                                                                                                                                                                                                                 |                                                                                                                                                                                                           |

## Architecture Diagrams

**Chat**

<img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/architecture-diagram-chat.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=e1d462bf9eb85083dae1461b44938576" alt="architecture-diagram-chat" width="694" height="813" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/architecture-diagram-chat.png" />

**Voice**

<img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/architecture-diagram-voice.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=27ceb8a5ec497f12577a74a6c26071f9" alt="architecture-diagram-voice" width="727" height="829" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/architecture-diagram-voice.png" />

## Interaction Sequence

<img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/interaction-sequence.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=641b222f545ef79374dce3210e7ebfd8" alt="interaction-sequence" width="1201" height="481" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/interaction-sequence.png" />

## Activities on Platform

* [Capture AI Agent information in Kore Data Table](#capture-ai-agent-information)
* [Access Custom Data and Secure Custom Data in Agent AI](#access-custom-data-and-secure-custom-data-in-agent-ai)

## Activities on Genesys Cloud

* [Generate an Oauth ID to connect Kore Services with Genesys](#generate-an-oauth-id-to-connect-kore-services-with-genesys)
* [Create an Interaction Widget in Genesys for Agent AI](#create-an-interaction-widget-in-genesys-for-agent-ai)
* [Provide Interaction Widget Access to Agents](#provide-interaction-widget-access-to-agents)
* [Create a Queue in Genesys](#create-a-queue-in-genesys)

## Chat Setup

* [Create or Update Architect Inbound Message Flow in Genesys for the Agent Queue](#create-or-update-architect-inbound-message-flow-in-genesys-for-the-agent-queue)
* [Create Messenger Configuration](#create-messenger-configuration)
* [Create Messenger Deployments](#create-messenger-deployments)
* [Steps to start a Chat Request Simulation](#post-installation-setup)

## Voice Setup

* [(Optional) Install Audiohook for Voice Streaming](#optional-install-audiohook-for-voice-streaming)
* [Create or Update an Architect Inbound Call Flow in Genesys for the Agent Queue](#create-or-update-architect-inbound-call-flow-in-genesys-for-the-agent-queue)
* [Steps to start a Voice Request Simulation](#post-installation-setup)

## Prerequisites

* Genesys Administrator with access to a Genesys Cloud account with Admin rights
* Platform Administrator with access to Agent AI instance

## AI for Service Configuration

For the configured app, ensure configuration of at least one Dialog Task for Agent AI use.

<img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/images/dialog-settings-page.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=db4c70da3bf1b71411f4e421eb0a5438" alt="dialog-settings-page" width="1311" height="1668" data-path="ai-for-service/agentai/integration/genesys/images/dialog-settings-page.png" />

## Capture AI Agent Information

### Genesys Data Table

Create a Genesys Data Table with Agent AI bot details:

<Note>The Custom Fields of the Data Table store the configuration data, not the Data Table row. A single Data Table represents one AgentAssist configuration. The default values of the Custom Fields contain the configuration data the AgentAssist widget needs to load.</Note>

1. Sign in to **Genesys Cloud**.

2. Select **Collaborate** / **Communicate**.

3. Select **Menu** > **Orchestration** > **Orchestration Assets** > **Data Tables**.

4. Select **+ Add** to create a new Data Table.

5. Enter a relevant name, such as KoreaiAA-configuration, and then select **Save**.

   <Note>You must set the **Reference Key** Label to `AgentAssist`. The Interaction Widget uses this value to load the configuration data.</Note>

6. Select the pencil icon to edit a data table.

   <Note>Don't select the data table name.</Note>

7. Select **Add Field** under **Custom Fields** to create seven custom fields to provide the AgentAssist configuration. Set the data type of all custom fields as **String**.
   <img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/images/custom-fields-add-field.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=b58de65a82d2caf77ca6ca015e111896" alt="custom-fields-add-field" width="1165" height="715" data-path="ai-for-service/agentai/integration/genesys/images/custom-fields-add-field.png" />

8. Add the custom fields with bot details.

9. Follow these conventions in the table for other custom fields. Use the exact names, including upper/lowercase.

|                             |                                           |
| --------------------------- | ----------------------------------------- |
| **Field Label**             | **Default Value**                         |
| AgentAssist URL             | Agent AI URL                              |
| Bot Id                      | `st-8cb94691-xxxx-xxxx-xxxx-xxxxxxxx`     |
| Client Id                   | `cs-b60f544d-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |
| Client Secret               | \<secret-key from AgentAssist>            |
| is Audiohook Enabled        | `true` / `false`                          |
| isAgentAISDK                | `true` / `false`                          |
| isSipInviteTransferFromKore | `true` / `false`                          |

<Note>
  When **is Audiohook Enabled** is set to `false`, the application uses the Genesys native transcription service through the Transcriptions API.
</Note>

To change the value of a field, select the drag icon next to the field name and enter the new value in the default box under **String Field Options**.

<img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/images/enable-audiohook.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=e0fdff9dd3ea3cae69910a6933cb106f" alt="enable-audiohook" width="1884" height="473" data-path="ai-for-service/agentai/integration/genesys/images/enable-audiohook.png" />

### Third-Party Configuration

[Third-Party Configuration](/ai-for-service/agentai/configuration/third-party-configuration) maps Agent AI bots to specific queues. Within this configuration, you can define the bot's language, custom data configuration, or secure custom data configuration.

For example, if you want to associate Agent AI Bot1 with Queue1 and Agent AI Bot2 with Queue2, you need to:

* Create a record in Third Party Configuration for Agent AI Bot1, setting the Queue Identifier as Queue1.
* Create a record in Third Party Configuration for Agent AI Bot2, setting the Queue Identifier as Queue2.

This setup ensures the correct Agent AI widget renders for conversations in the defined queues.

<Note>
  * The system doesn't support Custom Data.
  * You can't map one queue to multiple Agent AI bots.
</Note>

Refer to [Third Party Configuration](/ai-for-service/agentai/configuration/third-party-configuration) for instructions on creating records in Third-Party Configuration for an Agent AI Bot.

**Example**:

You have a queue named **Chat\_Skill** that handles incoming chat requests, and you want the Agent AI widget to render to this queue. You must create the following details of the Third-Party Configuration record in your Agent AI account:

<img src="https://mintcdn.com/koreai-apis/tMRAJSSWzEupalhp/ai-for-service/agentai/integration/genesys/images/create-record.png?fit=max&auto=format&n=tMRAJSSWzEupalhp&q=85&s=1c35b4370c54619e7d37eefe8a07747d" alt="create-record" width="639" height="933" data-path="ai-for-service/agentai/integration/genesys/images/create-record.png" />

<img src="https://mintcdn.com/koreai-apis/tMRAJSSWzEupalhp/ai-for-service/agentai/integration/genesys/images/add-value.png?fit=max&auto=format&n=tMRAJSSWzEupalhp&q=85&s=fb2fd12d6b9da5fe3008f2345f69809d" alt="add-value" width="638" height="932" data-path="ai-for-service/agentai/integration/genesys/images/add-value.png" />

<Note>Encode all values in base64.</Note>

<img src="https://mintcdn.com/koreai-apis/tMRAJSSWzEupalhp/ai-for-service/agentai/integration/genesys/images/third-party-configuration.png?fit=max&auto=format&n=tMRAJSSWzEupalhp&q=85&s=facfa44eeb995abe55daec540bf79172" alt="third-party-configuration" width="1602" height="474" data-path="ai-for-service/agentai/integration/genesys/images/third-party-configuration.png" />

<Note>Verify that **Third Party Configuration** is on in **Widget Settings** > **Agent AI General Settings**.</Note>

### Kore Data Table

Data Tables store queue-specific AI Agent credentials. Each record in the Kore Data Table represents a unique Genesys agent queue and its corresponding AI Agent definitions.

If you use a single AI Agent for several queues, create a record and insert the queue names, separated by commas, as the value for the QueueIdentifier, along with the AI Agent details.

Kore matches the third-party queue name with the `QueueIdentifier` credential name in its AI Agent credentials to render the appropriate AI Agent.

* The system fetches AI Agent credentials based on Genesys desktop queue names. If the Genesys queue name is of the `<QUEUEIDENTIFIER><QDELIMITER>XXXXX` format, for example `ALPHAINC_CUSTOMERSERVICE_16092024`, then:
* QueueIdentifier = `ALPHAINC` and qDelimiter = `_`.
* Update the QueueIdentifier in the Kore Data Table.
* Update the qDelimiter in the [Create an Interaction Widget in Genesys for Agent AI](#create-an-interaction-widget-in-genesys-for-agent-ai) section.

<Note>Don't enter multiple records with different AI Agent credentials in Kore Data Table for a single QueueIdentifier.</Note>

### How to create a new Data Table

1. Sign in to **AI for Service**.
2. Select **Data** > **Data Tables**.
3. Select **New Table**.
4. Enter the following details in the **New Table** page:
   1. **Name** of the Data Table (any alphanumeric name).

   2. **Description** of the Data Table.

   3. **Columns** to include in the Data Table. Select the check mark to add multiple columns.

      <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/multiple-columns.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=8e486c7d1cbc12e5cd193f06ec47f8b3" alt="multiple-columns" width="1399" height="430" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/multiple-columns.png" />

      Add the following case-sensitive columns with type string:

      **Mandatory Columns**:

      * QueueIdentifier (unique identifier for the table)
      * BotId
      * ClientId
      * ClientSecret
      * AgentAssistWidgetURL
      * AudiohookEnabled
      * JWEPublicKey

      **Optional Columns**:

      * KvpConfig
      * Algorithm (HS256)
      * RSPrivatePem (Ignore/Not Supported)
      * isAgentAISDK

   4. **Indexes** for the table.
      * **Index Name** for reference.
      * **Is Unique** flag to define if the index contains unique values. (Turn on **is Unique**.)
      * **Column & Sort Order** - List of columns to include in the index; you can select multiple columns and specify the sorting order (ascending or descending) for each column. (Select QueueIdentifier with ascending order.)
        <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/queue-finder.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=044d9d066d90e2308cf8d756099381f0" alt="queue-finder" width="1464" height="410" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/queue-finder.png" />

   5. **AI Agent Assignments** (not applicable).

   6. **App Assignments** to let apps access data in this table.
      1. Select any app from the list, or select **Create New App** and enter your app name.
      2. Select the **Read**, **Write**, and **Delete** permissions, based on your requirement.

         <Note>You can also create new apps by selecting **Data** > **Apps** > **New App** in the home page:</Note>

   7. **Process Assignments** (not applicable).
5. Select **Create** to create the new data table.

### Insert data into Data Table

Set up necessary permissions and app assignments and insert AI Agent-specific data into the Data Table.

1. Sign in to **AI for Service**.

2. Select **Data** > **Apps**.

3. Select the app with write access to the Data Table where you want to add information.

4. Copy **Client ID** and **Client Secret** of the app.

   <img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/app-write-access.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=ddc6ffa74f5dd90efd091a713109a051" alt="app-write-access" width="1920" height="827" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/app-write-access.png" />

5. Create a JWT Token using the **Client ID** and **Client Secret** by following the [Generating the JWT Token](/ai-for-service/apis/automation/api-introduction#generating-the-jwt-token) doc.

6. Insert the following data into the Data Table by following the [Data Insert API](/ai-for-service/apis/automation/data-insert) doc. Use the JWT Token you created.

   **API Body Payload Structure**:

   ```json theme={null}
   {
       "data": {
           "QueueIdentifier": <Unique QueueIdentifier>,
           "BotId": <Kore BotId>,
           "ClientId": <Kore ClientId>,
           "ClientSecret": <Kore ClientSecret>,
           "AudiohookEnabled": `true` / `false`,
           "AgentAssistWidgetURL": <Kore Agent AI Widget URL>,
           "KvpConfig": <KVPs of SecureCustomData>,
           "JWEPublicKey": <Public Key assigned to Client App>,
           "Algorithm": "HS256"
       }
   }
   ```

   <Note>
     * For a single queue, the QueueIdentifier value contains one queue name (for example, `Kore`). For multiple queues, it includes all the queue names separated by commas (for example, `Kore, KoreSupport`).
     * `JWEPublicKey` and `KvpConfig` values must be JSON objects converted to strings.
   </Note>

**Single Queue Example**

<img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/single-queue-example.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=ff85c3517f65e86a48d50922c9b00304" alt="single-queue-example" width="1420" height="699" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/single-queue-example.png" />

**Multiple Queues Example**

<img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/multiple-queues-example.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=2589bc54afa7f44257eace6f7d81a86a" alt="multiple-queues-example" width="1421" height="713" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/multiple-queues-example.png" />

## Generate an Oauth ID to connect Kore Services with Genesys

1. Sign in to **Genesys Cloud**.

2. Select **Collaborate** / **Communicate**.

3. Search for **OAuth**.
   <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/search-for-oauth.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=5fb1fcf7974452c0d1a2bb304c5086d0" alt="search-for-oauth" width="1849" height="935" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/search-for-oauth.png" />

4. Select **Add Client**.

5. Enter the **app name** and **description**, and select **Code Authoriztion/PKCE** as the **Grant Type**.

6. Enter token duration and add `{Agent AI URL}/koreaiaa-genesys/` in the **Authorized redirect URIs** field.

7. Add the following list of scopes in the **Scope** section:
   * architect:readonly
   * conversations
   * conversations:readonly
   * integrations
   * integrations:readonly
   * messaging
   * messaging-platform
   * messaging-platform:readonly
   * messaging:readonly
   * notifications
   * user-basic-info
   * web-chat
   * web-chat:readonly

<img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/authorized-redirect-uris.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=398770a0cc4537906bcc04cb8a96fce7" alt="authorized-redirect-uris" width="1849" height="935" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/authorized-redirect-uris.png" />

After saving the configuration, you get the **Client Id** of the OAuth client. Copy the ID and have it available for [the next step](#create-an-interaction-widget-in-genesys-for-agent-ai).

## Create an Interaction Widget in Genesys for Agent AI

Create a new Interaction Widget. The Genesys Agent Desktop hosts this widget, and it provides the Agent AI solution features to agents.

1. Sign in to **Genesys Cloud**.
2. Select **Collaborate** / **Communicate**.
3. Select **Menu** > **Integrations**.
4. If you haven't created an Interaction Widget for Agent AI, install a new **Interaction Widget** by selecting **Add integration**.
5. Enter a meaningful name for the Interaction Widget, such as KoreaiAA Interaction Widget.
6. Open the Interaction Widget by selecting the name.
7. Go to the **Configuration** tab of the Interaction Widget.
8. In the **Application URL** field, enter the following structure:

   ```
   {Agent AI URL}/koreaiaa-genesys/?conversationid={{gcConversationId}}&lang={{gcLangTag}}&environment={{gcHostOrigin}}&genesysid=<genesys-oauth-Id>&x_passthru_metadata=<Token>&showWidget=true/false&sendEventsToVG=true/false&oauthgrant=pkce
   ```

   <Note>
     * `x_passthru_metadata` is an optional query parameter for passing custom data to Agent AI.
     * `showWidget`: Determines whether the Agent AI widget appears during agent transitions.
       * Set to `true` to display the widget for Agent 1, if Agent 1 exits and Agent 2 takes over the conversation.
       * Set to `false` to hide the widget during these transitions.
     * `sendEventsToVG`: Determines whether the system sends events to Voice Gateway to pause or resume transcriptions when agents put a call on hold or resume it. This reduces Automatic Speech Recognition (ASR) costs by avoiding transcription of hold music from Genesys.
       * Set to `true` to use the new Audiohook flow for transcriptions, which uses the configurations under Advanced Settings.
       * Set to `false` to continue using the old Audiohook flow for transcriptions.
   </Note>

Add the following parameters to the Application URL based on how you store bot details:

**Kore Data Table**: `&multibot=true&x_metadata=<?x=%7B%22datatable%22%xxxxx>`
The `x_metadata` value equals the URL-encoded string of JSON object.

**Third Party Configuration**: `&accountid=<bot-account-id>`
You can fetch the accountId from the **Agent AI** > **Flows & Channels** > **Digital** > **Web/Mobile Client** > **JWT App Details** page.

The `x_metadata` value equals the URL-encoded string of the JSON object.

1. For the oauthId value, use the **OAuth ID** from the [Generate Oauth ID](#generate-an-oauth-id-to-connect-kore-services-with-genesys) section.

2. Build `x_metadata`:

   1. Sign in to **AI for Service**.

   2. Select **Data** > **Data Tables**, and copy the Data Table name.

   3. Select **Apps**, and select one of the app names with read access.

   4. Copy the **Client ID** and **Client Secret** values.

   5. Create a **JWT Token** using the **Client ID** and **Client Secret** by following the [Generating the JWT token](/ai-for-service/apis/automation/api-introduction#generating-the-jwt-token) doc.

   6. Generate a JSON object with the following structure, and then convert it into a URL-encoded string:

      ```json theme={null}
      {
       "datatable": {
         "name": <paste datatable name>,
         "token": <paste token created in previous step>,
         "qDelimiter": <Paste the special character used in the queue name to distinguish the QueueIdentifier from the remaining part of the queue name>
       }
      }
      Website for url encoding - urlencoder
      ```

      Reference:

      <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/java-script-demo.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=bdf362a156b8e0bab8b02591c63d6f05" alt="java-script-demo" width="788" height="371" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/java-script-demo.png" />

   7. Copy the URL-encoded string and paste it as the `x_metadata` value.

3. Allow all permissions in **iFrame Sandbox Options** and **iFrame Feature/Permission Policy**:

   **iFrame Sandbox Options**: allow-forms,allow-modals,allow-popups,allow-presentation,allow-same-origin,allow-scripts,allow-downloads.

   **iFrame Feature/Permission Policy**: camera,microphone,geolocation,clipboard-write,display-capture,fullscreen.

   **Communication Type Filtering**: chat and call.

## Provide Interaction Widget access to agents

To view the Interaction Widget, agents must have the following accesses:

### Group Membership

An Interaction Widget uses Group Membership to determine who can view it on the agent desktop.

1. Use an existing group, if your agents are already part of it. Otherwise, create a new group for Agent AI permission.
2. Name the group as **KoreAA-Agents** or a similar name to distinguish it.
3. Add any agent to allow them to use the Agent AI functionality. You can use multiple groups.
4. Go back to the **Integrations** section and open the **Interaction Widget** you created in the [Create an interaction widget](#create-an-interaction-widget-in-genesys-for-agent-ai) section.
5. On the **Configuration** tab, add access using the group you identified or created for Agent AI in the Group Filtering option.
   You may also use Queue Filtering (optional).
   <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/group-filtering.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=4ac2aa38b25e1aee6eea1fa8d45c1742" alt="group-filtering" width="2048" height="725" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/group-filtering.png" />

### Custom Role/Permission

along with the basic agent role, add the following role:

1. Sign in to **Genesys Cloud**.

2. Select **Collaborate** / **Communicate**.

3. Select **Menu** > **User Management** > **Roles and Permissions**.

4. Select **Add Role** to create a new role.

5. Enter a distinctive name to the role; for example, KoreaiAA Agent.

6. On the **Permission** tab, search for **Conversation** > **Transcription - View**, and add it (select the box):

   <Note>The Conversation permission is available only in the CX3 license.</Note>

   The **Assigned Permissions** view looks like the following image:

   <img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/assigned-permissions.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=4c22ef5d62006b17a7524c29bfa92e60" alt="assigned-permissions" width="1517" height="283" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/assigned-permissions.png" />

7. On the **Roles and Permissions** page, select the three dots at the right end of a role, and select **Change Membership**. Add the appropriate agents to the role.
   <img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/change-membership.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=7e09b5d7a03aa6462aa3b1643c5d642f" alt="change-membership" width="832" height="331" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/change-membership.png" />

## Create a Queue in Genesys

1. Sign in to [Genesys Pure Cloud](https://apps.mypurecloud.com/).

2. Select **Collaborate** / **Communicate**.

3. Select **Menu** > **User Management** > **Queues**, or enter `queues` in the search bar under the **Collaborate** / **Communicate** section and press the **Enter** key.

4. Select **Create Queue**.

5. Enter/select the following details in the **Create Queue** page:
   * **Name**: Enter a unique name for the new queue.
   * **Division**: Select a division in which you want to place this queue.
   * **Copy settings and members from (optional)**: Select an existing queue name, if you want to copy the settings and members from it.
   * **Peer Id** (optional): Enter a unique ID the system can use to identify the queue from an external platform.

6. Select **Save**.

### Enabling the Audio Monitoring toggle

To stream audio to third-party services, follow these steps:

1. Sign in to [Genesys Cloud](https://apps.mypurecloud.com/).
2. Select **Menu** > **User Management** > **Queues**, or enter `queues` in the search bar under the **Collaborate** / **Communicate** section and press the Enter key.
3. Select a queue name.
4. Select the **Voice** tab.
5. Turn on the **Audio Monitoring** toggle.

   <img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/audio-monitoring-toggle.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=7a89ee5dc0d272d41c1ec004af91d355" alt="audio-monitoring-toggle" width="1908" height="882" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/audio-monitoring-toggle.png" />

   **Audio Monitoring**: Voice settings on a Queue have an additional **Audio Monitoring** option, separate from **Voice Transcription**. This gives you control over which features you turn on. Audio Monitoring activates in the queue only if your organization activates Audiohook Monitor.

## Chat Setup

### Create or Update Architect Inbound Message Flow in Genesys for the Agent Queue

This step manages incoming messages to the Genesys platform. When you initiate a chat from the [web chat messenger](https://developer.genesys.cloud/devapps/web-chat-messenger), Genesys routes it to this inbound message flow first.

1. Sign in to [Genesys Cloud](https://apps.mypurecloud.com/directory/#/login-oauth).

2. Go to **Menu** > **Orchestration** > **Architect**.

3. Select the three dots next to **Flows: Inbound Call**, and select **Inbound Message**.
   <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/inbound-message.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=122a5e9a39a54a2237069f8e4c7cd330" alt="inbound-message" width="355" height="819" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/inbound-message.png" />

4. Select **+Add** to create an **Inbound Message Flow**.

5. Enter the name and description of the inbound message flow.

6. Select **Create Flow**. The final architect flow looks like the following screenshot:
   <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/create-flow.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=58e32437f85d905ca0dbfbd0dd6c9ddc" alt="create-flow" width="1847" height="774" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/create-flow.png" />

7. Select **Publish**.

### Create Messenger Configuration

Before using web messaging, you must configure it in Genesys Cloud. To configure Web or Mobile Messaging in your organization, follow these steps:

1. In [Genesys Cloud](https://apps.mypurecloud.com/), go to **Menu** > **Digital and Telephony** > **Message** > **Messenger Configurations**.

2. Select **New Setup**.

3. Enter a name and description.

4. Select a digital channel: **Messaging**, **Knowledge**, or **Knowledge Portal**.

5. Select **Next**.

6. In the **Appearance** tab, complete the following information:

   * Under **Select your Supported Languages**, select the **Select language(s)** list and choose the languages that you want to support in the Messenger interface.

     <Note>You must configure the same language in **Kore AI Agent**.</Note>

   * Under **Select Default Language**, select the **Select language** list and choose the default language.
     <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/default-language.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=4d3d293e0235b54e9b1ec8bb542ef0a5" alt="default-language" width="1846" height="928" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/default-language.png" />

   * Adjust the other settings according to your preferences.

7. Select the **Apps** tab and complete the following steps:
   * Under **Clear Conversation**, turn the toggle on. You need this for the **Agent AI Conversation Summary** feature to work.
     <img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/clear-conversation-toggle.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=a27f5b19773d875bd2a441f86ea30592" alt="clear-conversation-toggle" width="1847" height="932" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/clear-conversation-toggle.png" />

   * Adjust the other settings according to your preferences.

8. Select **Save New Version** to create a new version.

### Create Messenger Deployments

To deploy the Messenger snippet to your website, follow these steps:

1. In [Genesys Cloud](https://apps.mypurecloud.com/), go to **Menu** > **Digital and Telephony** > **Message** > **Messenger Deployments**.

2. Select **New Deployment**.

3. Enter a name and description.

4. Under **Select your Configuration**, select the **Select Configuration** option to select a version of a messenger configuration you created in the previous step to assign to this deployment.
   * In the **Assignment** pane, navigate to the Messenger configuration you want to assign to the configuration, and select the name of the Messenger configuration.
   * Select the version you want to assign.
   * Select **Save**.

5. Under **Restrict domain access**, determine whether to allow all domains or restrict the domains on which you want to deploy the snippet.
   * To allow all domains, select **Allow all domains**. (Use this option for testing and development purposes.)
   * To restrict domains, enter a domain and select **Add Domain**. You can add multiple domains to the list. Restrict domains to prevent unauthorized usage of your snippet from unknown domains. If you restrict a domain, Messenger doesn't run on that website and rejects API requests from that domain.

6. Under **Select your Architect Flow**, select the inbound message flow you created in the previous steps.

7. Select **Save**. The Messenger Deployments page now displays the snippet and the deployment key.

8. Copy the Messenger snippet and deploy the Messenger snippet to your website.
   If you are building a custom Messenger, copy the deployment key.

   <Note>The Messenger window appears after the website page loads.</Note>

## (Optional) Install Audiohook for Voice Streaming

Install Audiohook for voice streaming if using Kore-managed transcriptions.

1. In [Genesys Cloud](https://apps.mypurecloud.com/), go to **Collaborate** / **Communicate** > **Menu** > **IT and Integrations** > **Integrations**.

2. Enter `audiohook` in the search bar. Audiohook integration requires specific configuration values to support Agent AI configuration.

3. Install a new audiohook app by selecting **Integrations** in the upper-right corner.

4. Open the **Audiohook**, and go to the **Configuration** tab.

   1. **Channel** value must be both.
   2. The **Connection URI** format must be similar to `wss://{Voice Gateway}/audiosocket/genesys/?sipuri=xxx&token=xxx&botId=xxx&accountId=xxx&agentassist=true`.

   <Note>
     * Add `multiBot=true` parameter to it to use multiple Agent AI bots with different queues.
     * Configure the SIP of any of the bots inserted in the Data Table.
     * Get the Voice Gateway host name from the corresponding environment you use at SaaS or on-prem.
   </Note>

5. Follow these steps to get the **Connection URL**:
   1. Go to **Agent AI** > **Flows & Channels** > **Voice Gateway** > **SIP Numbers** > **Configure SIP Trunk**.
   2. Select **Agent AI** in the **Product Selection** section.
   3. Select **Genesys Audiohook** in the **Select the SIP Trunk connection method** dropdown list.
   4. Select **Copy** next to the **Connection URL** field.

6. Add the following details in the **Advanced** tab:

   ```json theme={null}
   {
     "environment": <genesys-environment(For example: mypurecloud.com)>,
     "oauthClientId": <genesys-oauth-id>,
     "koreDomainURL": <Agent AI URL>,
     "oauthClientSecret": <genesys-oauth-secret>,
     "sendEventsToVG": `true`,
     "botId": <Bot-ClientID>,
     "token": <JWT-token-created-in-previous-step-using-Bot-ClientID-and-ClientSecret>
   }
   ```

   <Note>Create an OAuth using the **Client Credentials** grant type, and use the resulting **Client ID** and **Client Secret** for configuration.</Note>

   <img src="https://mintcdn.com/koreai-apis/tMRAJSSWzEupalhp/ai-for-service/agentai/integration/genesys/images/advanced-configurations.png?fit=max&auto=format&n=tMRAJSSWzEupalhp&q=85&s=55622cc1ba04f2cfb5f10fe0eb3bb83b" alt="advanced-configurations" width="1819" height="800" data-path="ai-for-service/agentai/integration/genesys/images/advanced-configurations.png" />

7. Add credentials in the **Credentials** tab.

8. Use the **ClientID** and **ClientSecret** of the AI Agent you used while configuring the Audiohook. The system uses these credentials to validate the audio stream signature.

9. Select **Save**.

## Create or Update Architect Inbound Call Flow in Genesys for the Agent Queue

Calls coming to a Genesys number pass through an architect flow. If you don't have an Automatic Call Distribution (ACD) architect flow for the queue, create one by following this section.

1. In [Genesys Cloud](https://apps.mypurecloud.com/), go to **Menu** > **Orchestration** > **Architect**.
2. Select **+Add** to create an **Inbound Call Flow**.
3. Select **Create Flow**. The final architect flow looks like the following screenshot:
   <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/final-architect-flow.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=3b7362c0c8980defcc4d5cf5d42288b5" alt="final-architect-flow" width="1630" height="827" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/final-architect-flow.png" />

<Note>
  * Inside the **Transfer to ACD** node, select the queue name to transfer the call.
  * The **Transcription node** is optional, if you have turned on Voice Transcription and Audio Monitoring in the queue-level voice configuration.
  * Architect flow is a mandatory step, as it directs the incoming call to the Genesys agent desktop.
</Note>

## Access Custom Data and Secure Custom Data in Agent AI

You can access Custom Data and Secure Custom Data in:

* Welcome Events in the Agent AI configuration page
* Dialog Tasks in the Agent AI automation page

You can access Custom Data as `{{context.session.UserContext.customData.internalMetaData.<key>}}`. Follow the [Access Custom Data](/ai-for-service/agentai/agent-experience#access-custom-data) doc for the detailed steps on how to access Custom Data.

You can access Secure Custom Data as `{{context.session.UserContext.secureCustomData.<key>}}`. Follow the same steps of the [Access Custom Data](/ai-for-service/agentai/agent-experience#access-custom-data) doc for detailed information on how to access Secure Custom Data, except for the path being `{{context.session.UserContext.secureCustomData.<key>}}`.

<Note>If a URL-encoded JSON is provided in the `x_passthru_metadata`, use the JavaScript option in the Message node. Then, parse the value of `context.session.UserContext.customData.internalMetaData` before accessing its content.</Note>

**Example**:

```json theme={null}

var cd = JSON.parse(context.sessiinternalMetaDataon.UserContext.customData.internalMetaData);

print(cd.\<key\>);

```

## Post Installation Setup

**Start a Chat Request Simulation**:

1. Sign in to [Genesys Developer Applications](https://developer.genesys.cloud/devapps/web-chat-messenger).

   <Note>To start chat simulation, you must have access to the Genesys Developer portal (an account with Genesys).</Note>

2. Select **Web messenger**, select the **Deployments**, and then select **Start Chat** to initiate the chat request.
   <img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/chat-simulation-web-messenger.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=8c58e9557bd9a6d7981b54b644635212" alt="chat-simulation-web-messenger" width="1670" height="794" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/chat-simulation-web-messenger.png" />

3. Enter a message on the **Message Us** window, and then select the **Send** icon.
   <img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/chat-simulation-message-use.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=b63bcafb8a3e75e83015af8346424191" alt="chat-simulation-message-use" width="300" height="278" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/chat-simulation-message-use.png" />

4. Turn on the **On Queue** toggle on the upper-right corner of the page. A new chat notification appears on the **Genesys Agent Desktop**.

5. Accept the conversation by selecting **Answer** on the left panel.

6. Select the Interaction Widget icon to view the Agent AI widget.
   <img src="https://mintcdn.com/koreai-apis/HzHZEVZ4fNTul9hQ/ai-for-service/agentai/integration/genesys/kore-data-table/interaction-widget-icon-chat.png?fit=max&auto=format&n=HzHZEVZ4fNTul9hQ&q=85&s=f1d7013f6426844cd7f53b30c1d23a97" alt="interaction-widget-icon-chat" width="1920" height="871" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/interaction-widget-icon-chat.png" />

**Start a Voice Request Simulation**:

1. In **Call Routing**, assign the **Architect flow** you created in a [previous step](#steps-to-create-a-call-architect-flow) to a Genesys phone number.
2. Initiate a call using this Genesys phone number. A new call notification appears on the Genesys Agent Desktop.
3. Accept the conversation by clicking **Answer** on the left panel.
4. Select the Interaction Widget icon to view the Agent AI widget.
   <img src="https://mintcdn.com/koreai-apis/cfFS9HJhB87RtEXT/ai-for-service/agentai/integration/genesys/kore-data-table/call-interaction-details.png?fit=max&auto=format&n=cfFS9HJhB87RtEXT&q=85&s=b1a8c1a8b2c58ec566be01a78b0c5922" alt="call-interaction-details" width="1920" height="872" data-path="ai-for-service/agentai/integration/genesys/kore-data-table/call-interaction-details.png" />

## Set the default contextual panel to Kore Agent AI Interaction Widget

To streamline call handling and improve efficiency, you can embed the Agent AI widget as the primary contextual panel interaction widget.

To set this up:

1. In [Genesys Cloud](https://apps.mypurecloud.com/), select **Menu** > **Digital and Telephony** > **Interaction Assets** > **Panel Manager**. This opens the **Default Contextual Panel**.
2. Select the interaction widget name in both **Voice** and **Web Messaging** field dropdown lists (refer to step-4 of [Create an Interaction Widget in Genesys for Agent AI](#create-an-interaction-widget-in-genesys-for-agent-ai)).
3. Select **Save**.

   <Note>Reload the Genesys Agent Desktop before testing this latest change.</Note>

## Support for Agent Transfer

The Agent AI widget supports both Cold and Warm Transfers:

* **Cold Transfer**: A cold transfer occurs when one agent hands over a conversation to another, and it's applicable across Voice, Chat, and Email channels. The system generates a new conversation summary for the receiving agent and adds it to Agent-1's **Assist** tab, along with feedback options. Agent-2 can modify the summary feedback for Voice and Email channels.
* **Warm Transfer**: A warm transfer is like a conference call between two agents, applicable to Voice and Chat channels. During the transfer, Agent-2 can modify the summary feedback. However, the **Run**, **Override**, **Send**, **Copy**, **Terminate**, **Restart**, and **List View** buttons remain unavailable until Agent-1 disconnects from the call.

## Switch to Agent AI SDK (Optional)

You can embed the Agent AI widget into the Genesys desktop using the Web SDK. To do this, update the following configurations:

### Kore Data Table Change

1. Go to the **Kore Data Table**.

2. Select on the name of the Data Table.

3. Add a new column to the existing data table as **isAgentAISDK** and data type as **string**.
   <img src="https://mintcdn.com/koreai-apis/tMRAJSSWzEupalhp/ai-for-service/agentai/integration/genesys/images/new-column.png?fit=max&auto=format&n=tMRAJSSWzEupalhp&q=85&s=40b3fa3dd2fe04c5336219963a743e31" alt="new-column" width="1465" height="709" data-path="ai-for-service/agentai/integration/genesys/images/new-column.png" />

4. Select **Create**/**Update** (for existing table configuration).

### Insert or update data into Data Table

For first-time users, use the POST API and for existing users, use the PUT API to insert this new field into the Kore Data Table.

**API Body Payload Structure**:

```json theme={null}
    {
        "data": {
            "QueueIdentifier": <Unique QueueIdentifier>,
            "BotId": <Kore BotId>,
            "ClientId": <Kore ClientId>,
            "ClientSecret": <Kore ClientSecret>,
            "AudiohookEnabled": "true" / "false",
            "AgentAssistWidgetURL": <Kore Agent AI Widget URL>,
            "KvpConfig": <KVPs of SecureCustomData>,
            "JWEPublicKey": <Public Key assigned to Client App>,
            "Algorithm": "HS256",
           "isAgentAISDK": "True"
        }
    }
```
