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

# Agent AI Chat and Email Integration with Five9

This document explains how to integrate the Agent AI widget into the Five9 Agent Desktop. The integration supports automation, [Agent Coaching](/ai-for-service/agentai/agent-experience/agent-realtime-coaching#real-time-agent-coaching), [Agent Playbook](/ai-for-service/agentai/agent-experience/playbook#agent-ai-playbook), [Sentiment Analysis](/ai-for-service/agentai/agent-experience#sentiment-analysis), and end-of-call summaries.

## Prerequisites

Administrators with access to a Five9 Admin Console and with privileges to set up the following configurations:

* Five9 Chat and Email turned on for your instance. Contact your Five9 representative.
* Platform administrators with access to Kore.ai Agent AI instance and familiarity with creating and configuring a Kore AI Agent.
* Kore App credentials such as Account ID. Read the [Enable Digital Channels](/ai-for-service/channels/adding-channels-to-your-bot) doc for a walkthrough.

## Definitions

| **Key**          | **Definition**                                                                                                               | **Reference**                                                                                                                                               |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Agent AI URL     | The domain of the Agent AI.                                                                                                  | - If it's AI for Service, the URL is `https://platform.kore.ai`.<br /> - If it's on-prem, the URL is the origin that hosts Agent AI.                        |
| Connector        | The Five9 Connector displays the Agent AI iframe within the Five9 Agent Desktop.                                             |                                                                                                                                                             |
| Account ID       | A unique identifier for an account.                                                                                          | Available under **Channels** > **Chat** in the Agent AI configuration portal.                                                                               |
| BotLanguageCode  | The language configured in the Kore AI Agent.                                                                                | Refer to the [Supported Languages](/ai-for-service/agentai/agent-experience/supported-languages) document for the language code of all supported languages. |
| Queue Identifier | A unique identifier in the Data Table used to fetch AI Agent details at run time. It can be a skill name or a campaign name. |                                                                                                                                                             |

## Configurations on Kore Agent AI

* [Capture Agent AI Bot Mapping for Skills or Campaigns](#capture-agent-ai-bot-mapping-for-skills-or-campaigns)

## Configurations on the Five9 Admin Console

* [Create Connector](#create-connector)
* [Five9 Account Setup for Incoming Chat and Email Requests](#five9-account-setup-for-incoming-digital-requests)

### Capture Agent AI Bot Mapping for Skills or Campaigns

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

For example, if you want Agent AI Bot1 to associate with Skill1 and Agent AI Bot2 with Skill2, you must:

* Create a record in Third-Party Configuration for Agent AI Bot1, setting the Queue Identifier to Skill1.
* Create a record in Third-Party Configuration for Agent AI Bot2, setting the Queue Identifier to Skill2.

This setup ensures the correct Agent AI widget renders for conversations routed based on the defined skill or campaign.

<Note>
  * The system doesn't support Custom Data and Secure Custom Data for the Five9 Chat and Email integration.
  * You can't map a Skill or a Campaign to multiple Agent AI bots.
</Note>

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

**Example**:

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

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

<img src="https://mintcdn.com/koreai/wBhZm_F3YgBV6Nll/ai-for-service/agentai/integration/five9/images/create-record-add-values.png?fit=max&auto=format&n=wBhZm_F3YgBV6Nll&q=85&s=a33dbd67eb1792dc450bc2d07a4524b5" alt="create-record-add-values" width="638" height="932" data-path="ai-for-service/agentai/integration/five9/images/create-record-add-values.png" />

<Note>
  * The values must be 'Base64' encoded.
  * You must turn on the **Third-Party Configuration** setting in **Agent AI** > **Configurations** > **Widget Settings** > **Agent AI Settings** > **Agent AI General Settings**.
</Note>

## Create Connector

1. Sign in to [Five9 Administrator Console](https://admin.us.five9.net/).

2. Search for **connectors** in the search bar, and select **Connectors**.

3. Select **Create**.

4. Provide a name in the **Connector Name** field.

5. The URL must be `{Agent AI URL}/integrations/five9/`

6. The method must be GET.

7. Select **Next**.

8. Select **Field** from the **Add** dropdown list in the **Parameters** section.

9. Select **session\_id**, **domain\_id**, **id**, **skill\_name/campaign\_name** (choose either skill\_name or campaign\_name, depending on which you use to map the bot in Agent AI), and select **Ok**.
   <img src="https://mintcdn.com/koreai/WpX_vttOthVIy8Vp/ai-for-service/agentai/integration/five9/images/add-field-ok.png?fit=max&auto=format&n=WpX_vttOthVIy8Vp&q=85&s=0215ddf6ae05d9114597546c2dc97ac0" alt="add-field-ok" width="1843" height="894" data-path="ai-for-service/agentai/integration/five9/images/add-field-ok.png" />

10. Select the **Edit** icon next to each parameter and update the values as follows:
    * domain\_id -> domainid
    * id -> agentid
    * session\_id -> conversationid
    * skill\_name/campaign\_name -> identifiers
      <img src="https://mintcdn.com/koreai/WpX_vttOthVIy8Vp/ai-for-service/agentai/integration/five9/images/changing-parameters.png?fit=max&auto=format&n=WpX_vttOthVIy8Vp&q=85&s=8b1dd2e717f47263cd3b0394e78c7b14" alt="changing-parameters" width="1848" height="893" data-path="ai-for-service/agentai/integration/five9/images/changing-parameters.png" />

11. Select **Constant** from the **Add** dropdown list in the **Parameters** section.

12. Enter 'accountid' in the **Name** field and the **accountid** of your Agent AI account in the **Value** field. To find this ID, go to **Agent AI** > **Flows & Channels** > **Channels** > **Digital** > **Web/Mobile Client** > **JWT App Details**. For more details, see the [Adding the Web or Mobile Client Channel](/ai-for-service/channels/add-web-mobile-client#add-webmobile-client-channel) doc.

13. Select **Ok** > **Next**.

14. The default selection for **Trigger Event** is **Call** and for **On Call Event** is **On Call Accepted**.

15. **Trigger Event by Channel**:
    * **Chat**: Select **Chat** for **Trigger Event** — the **On Chat Event** field defaults to **On Chat Arrival**.
    * **Email**: Select **Email** for **Trigger Event** - the **On Email Event** field defaults to **On Email Arrival**.

16. Select **Done**.

## Five9 Account Setup for Incoming Digital Requests

### Chat

* Create a skill and assign configured agents to support the **Chat** or **SMS** channel. For details, see [User media channels](https://documentation.five9.com/bundle/admin-console/page/admin-console/users/user-media_channels.htm) and [Skills](https://documentation.five9.com/bundle/admin-console/page/admin-console/skills/_ch-user-skills.htm).
* Create a chat profile. Follow [Chat profiles overview](https://documentation.five9.com/bundle/digital-engagement/page/digital-engagement/admin-console/chat-profiles.htm), or use the default chat profile.
* Create an IVR script. Follow [Creating an IVR script](https://documentation.five9.com/bundle/ivr-admin/page/ivr-admin/examples/creating-an-ivr-script.htm).

### Email

* Create a skill and assign configured agents to support the **Email** channel. For details, see the [User Media Channels](https://documentation.five9.com/bundle/admin-console/page/admin-console/users/user-media_channels.htm) doc and the [Skills](https://documentation.five9.com/bundle/admin-console/page/admin-console/skills/_ch-user-skills.htm) doc.
* Create an email profile. Follow [Email profiles](https://documentation.five9.com/bundle/digital-engagement/page/digital-engagement/admin-console/email-profiles.htm), or use the default email profile.
* Create email configurations. Follow [All email accounts](https://documentation.five9.com/bundle/digital-engagement/page/digital-engagement/scc-email-interactions/creating-email-accounts/all-email-accounts.htm).
* Create an IVR script. Follow [Creating an IVR script](https://documentation.five9.com/bundle/ivr-admin/page/ivr-admin/examples/creating-an-ivr-script.htm).

### Create Inbound Campaign

1. Sign in to [Five9 Admin Console](https://admin.us.five9.net/).

2. Search for campaigns, and select **Campaigns**.

3. Select **Create**.

4. Select **Inbound** > **Continue**.

5. Enter the following details:
   1. Enter a **campaign name**.

   2. Enter a **campaign description**.

   3. Select the chat profile if the campaign handles chat interactions.

      <Note>You must have the necessary permissions to view campaign profiles. If you don't, an error message displays.</Note>

   4. Select the email profile if the campaign handles email interactions.

   5. **Voice Lines**: Enter the number of lines to dedicate to voice traffic. This value sets the maximum number of phone lines or ports to support the calls for this campaign.

   6. **Text Interactions**: Enter the number of lines to dedicate to text interactions.

      This setting runs IVR scripts for chat or email campaigns, and determines how many IVR sessions can run the IVR script concurrently. For example, if 10 customers are in a chat campaign and you set the number of text channels to 5, only 5 customer interactions use the IVR script. The remaining 5 route to the chat campaign's default skill without any scripting logic.

   7. Enter the **usage threshold percentage** value. This value sets the maximum percentage of lines in use. When usage reaches the threshold, the system sends a notification.

   8. Enter **email addresses for threshold notifications**. Use semicolons to delimit a list.

   9. Enter the number of lines to dedicate to **Visual IVR (VIVR) sessions**. This setting runs an IVR script using a web browser URL, but instead of TTS prompts playing audio (as in a voice call), it displays the actual TTS text. A voice caller and a VIVR caller get the same IVR flow and experience — one uses voice and the other uses a browser screen for online viewing. For more information about VIVR, see the [Interactive Voice Response (IVR)](https://documentation.five9.com/bundle/ivr-admin/page/ivr-admin/landing-ivr-admin.htm) admin guide.

   10. Select **Next**.

6. Leave the **Numbers** section empty, and select **Next**.

7. Use the **Digital** tab to configure email connections:
   * To add a new email configuration, select **Add Emails**.
   * To remove an email configuration, select the **X** icon.
     <img src="https://mintcdn.com/koreai/gXgZfMWCOXHRbANZ/ai-for-service/agentai/integration/five9/images/configure-email-connections.png?fit=max&auto=format&n=gXgZfMWCOXHRbANZ&q=85&s=e40c08c2203340f7af9e45e60de7c530" alt="configure-email-connections" width="1920" height="913" data-path="ai-for-service/agentai/integration/five9/images/configure-email-connections.png" />

8. Select **Default Script**, and select the default IVR script or the IVR script from the previous step.

9. Under **Enable Scripts**, select **Email** and **Chat** channels based on the channel you want to support.
   <img src="https://mintcdn.com/koreai/gXgZfMWCOXHRbANZ/ai-for-service/agentai/integration/five9/images/campaign-schedule.png?fit=max&auto=format&n=gXgZfMWCOXHRbANZ&q=85&s=51cc29688035fb30aa94c702d0ce8144" alt="campaign-schedule" width="1920" height="913" data-path="ai-for-service/agentai/integration/five9/images/campaign-schedule.png" />

10. Select **Next**.

11. Select **Digital Skill**, and select the skill from the previous step or **Default Skill**.

12. Select **Create**.
    <Note>After creating the inbound campaign, start it. Refer to the [Manage Campaigns](https://documentation.five9.com/bundle/admin-console/page/admin-console/campaigns/managing-campaigns.htm) doc for help.</Note>

13. Turn on the Email address you configured by using the toggle next to it under the **Digital** tab.
    <img src="https://mintcdn.com/koreai/gXgZfMWCOXHRbANZ/ai-for-service/agentai/integration/five9/images/enable-email-address.png?fit=max&auto=format&n=gXgZfMWCOXHRbANZ&q=85&s=3a84f0e54150031db081d7c788466d9c" alt="enable-email-address" width="1920" height="913" data-path="ai-for-service/agentai/integration/five9/images/enable-email-address.png" />

## Chat Simulation

1. Open [Script Generator](https://app.five9.com/five9_clients/consoles_latest/Generator/index.html).

2. Enter your Five9 account domain name in the **Domain** field and the chat inbound campaign name in the **Profiles** field.

3. Scroll down and select **Preview on Page**.

4. Enter values in the **Name** and **Question** fields.

5. Select **Start Chat**.
   <img src="https://mintcdn.com/koreai/WpX_vttOthVIy8Vp/ai-for-service/agentai/integration/five9/images/start-chat.png?fit=max&auto=format&n=WpX_vttOthVIy8Vp&q=85&s=35628cab5c9f4a517c8b2e25e0d61afc" alt="start-chat" width="1847" height="970" data-path="ai-for-service/agentai/integration/five9/images/start-chat.png" />

6. Open the **Five9 Agent Desktop**, and change the status to **Ready (Text)**.

7. Select the lock icon to accept the interaction.

8. Once you accept the interaction, the connector opens by default where the Agent AI widget renders.
   <img src="https://mintcdn.com/koreai/WpX_vttOthVIy8Vp/ai-for-service/agentai/integration/five9/images/agentai-widget.png?fit=max&auto=format&n=WpX_vttOthVIy8Vp&q=85&s=0f228c6f08f6783387f37dd6d0816659" alt="agentai-widget" width="1848" height="889" data-path="ai-for-service/agentai/integration/five9/images/agentai-widget.png" />

9. Select **send** to send a message to the customer.

10. Select **copy** to copy the message to the clipboard.
    When the agent or customer ends the chat, the chat summary displays in the Agent AI widget.
    <img src="https://mintcdn.com/koreai/WpX_vttOthVIy8Vp/ai-for-service/agentai/integration/five9/images/chat-summary.png?fit=max&auto=format&n=WpX_vttOthVIy8Vp&q=85&s=0afac9ca374c25b622523eee81e02da7" alt="chat-summary" width="1848" height="894" data-path="ai-for-service/agentai/integration/five9/images/chat-summary.png" />

## Email Simulation

1. Open the **Five9 Agent Desktop**, and change the status to **Ready (Text)**.
2. Initiate a mail to the inbound email address you configure.
3. Select the **lock** icon to accept the interaction. The connector opens by default where the Agent AI widget renders, and it sends the latest email thread to the Agent AI widget for suggestions generation.
4. Select **copy** to copy the message to the clipboard.
   If any new customer email arrives, the system automatically passes it to the Agent AI widget for suggestions generation.

## Integration Limitations

* The system doesn't support custom data and secure custom data.

* The system doesn't support internal transfers as the widget doesn't render for other agents joining the conversation, as the Five9 connector isn't available for other agents.

* **Concurrent Chats and Emails Limitation**: Agent AI widget receives customer messages or summary events for text interaction only when that interaction window is active. If the agent switches to a different interaction, the widget doesn't process new messages or events from the previous interaction.

* **Limitations related to Emails**:
  * When an agent switches between email interactions and other tabs using the left sidebar, the Agent AI widget reloads when the agent returns to the email interaction. During this reload, the system again passes the latest email thread to the widget.
  * The Five9 desktop application provides access to approximately 500 characters of the email thread. As a result, the system truncates email threads exceeding 500 characters and only passes the available portion to the Agent AI widget for suggestions generation.
