Salesforce voice integration with NiCE CXone

Architecture for the Agent Assist and NiCE CXone integration with Salesforce

This voice integration uses the NiCE CXone Agent for Service Cloud Voice (BYOT) Salesforce App to allow your agents to accept NiCE CXone calls in Salesforce Service Cloud Voice.

Agent Assist uses the voice call stream from NiCE CXone Agent Assist Hub to provide suggestions to your agents in the Salesforce Lightning Service Console.

Before you begin

To integrate Agent Assist UI modules with Salesforce, you need access to the following resources:

  • Node.js

    Follow the recommended installation instructions for your operating system.

  • Salesforce CLI

    Follow the recommended installation instructions for your operating system.

  • Google Cloud CLI

    Install the gcloud command as instructed and authenticate using gcloud auth login.

  • Salesforce UI

    1. Sign in at your instance URL or the Salesforce sign-in page and note the following:
      • Your Salesforce My Domain URL. Follow these steps to find the My Domain URL:
        1. Navigate to the menu bar > Setup menu.
        2. Click Setup.
        3. In the Quick Find box, enter My Domain. The domain name is in the following format: MY-DOMAIN-NAME.develop.my.salesforce.com.
      • Your Salesforce organization ID. Follow these steps to find the organization ID:
        1. Navigate to the menu bar > Setup menu.
        2. Click Setup.
        3. In the Quick Find box, enter Company Information.
  • Agent Assist integration backend

    1. Follow the instructions to set up the integration.
    2. Before running the deploy script, configure the following environment variables with deploy.sh, or in an .env file at the project root:
    3. AUTH_OPTION: Set this to SalesforceLWC.
    4. SALESFORCE_DOMAIN: A domain name similar to YOUR_SUBDOMAIN.develop.lightning.force.com. You noted this value in the Salesforce UI prerequisite. Note that you shouldn't include https://.
    5. SALESFORCE_ORGANIZATION_ID: You noted this value in the Salesforce UI prerequisite.
  • A NiCE CXone instance

  • A NiCE CXone Agent Assist Hub add-on license

    The NiCE CXone Agent Assist Hub add-on allows your NiCE CXone instance to send voice call media streams to Google Cloud's Agent Assist. NiCE CXone is a licensed product. More details are available in the NiCE CXone Agent Assist Hub documentation.

Step 1: Configure NiCE CXone Studio and NiCE CXone Agent Assist Hub

This step describes all the configuration necessary in your NiCE CXone instance.

Configure call flow with NiCE CXone Studio

In this step, you'll configure a programmatic call flow with NiCE CXone Studio to route incoming calls to your agents and send the call media streams to Agent Assist. Configure this call flow with the following NiCE CXone Studio triggers and actions, in this order:

  1. Sign in to NiCE CXone console.
  2. Open the Applications menu ().
  3. Open Omnichannel Routing > Studio.
  4. In the Studio page, create a New Script.

Configure this call flow with the following NiCE CXone Studio triggers and actions:

  1. Begin
  2. Reqagent
    • This action sends the call to a specified skill. Select the skill associated with the agents who you would like to receive calls.
  3. Music
    • This action plays hold music.
  4. Wait
    • This action suspends the flow until another trigger is activated.

Separately, but in the same Studio flow, configure what happens when an agent picks up the incoming call.

  1. Onanswer
    • This trigger is activated when an agent in the skill.
  2. Ziptone
    • This plays a beep when an agent picks up the phone in a NiCE CXone agent desktop (such as the NiCE CXone Agent for Service Cloud Voice (BYOT) softphone).
  3. Agent Assist
    • This action is responsible for creating a conversation and sending an incoming call's media streams to Dialogflow, so that the Agent Assist UI modules LWC can render the transcript and Agent Assist suggestions (such as PGKA, GKA, AI Coaching) in Salesforce. See this integration documentation for configuration details. Note: this step requires a pre-configured conversation profile.

You can also configure Agent Assist for outbound calls. The integration requires triggering the Agent Assist action when an outbound call is answered by the remote party. While the exact implementation depends on your configuration, this can typically be achieved in your script by using the Placecall action to initiate the call, and connecting the Agent Assist action to the OnAnswer branch of Placecall. See the NiCE CXone Studio help documentation for Placecall, Onanswer, and Agent Assist for more information.

Note NiCE CXone account details

Follow this step to collect your NiCE CXone account details. You will need this information to configure the NiCE CXone Agent for Service Cloud Voice (BYOT) in Salesforce later.

  • Make a note of your NiCE Business Unit number from the NiCE CXone console. In your Salesforce project (which you will clone in an upcoming step), in ServiceCloudVoicePlatformService.js, update CONFIG.niceBusNo to reflect your NiCE Business Unit number. This will let your Agent Assist UI modules LWC determine the conversationName that NiCE CXone Agent Assist Hub creates (see the generateNiCEConversationName method in the same file for details).
  • Make a note of your NiCE Point of Contact (POC) phone number from the NiCE CXone console. This is the number that your customers will call into to talk to your agents, and that you will use to test this Agent Assist integration.

Step 2: Set up your Salesforce development project

To start integrating Agent Assist UI modules, follow these steps.

  1. Run the following code to clone the Agent Assist integration repository and open your project:
    git clone https://github.com/GoogleCloudPlatform/agent-assist-integrations
    cd salesforce/aa-lwc
  2. Run the following commands to download the UI modules JavaScript files which you deploy later as Static Resources. Salesforce requires the static resources to load third-party JavaScript.
    npm run generate-static-resources
    npm install
  3. Update ServiceCloudVoicePlatformService.js with the NiCE Business Unit number you noted in a previous step: js const CONFIG = { // For this.platform = "servicecloudvoice-nice", the NiCE Business Unit Number // https://help.nicecxone.com/content/acd/businessunits/managebusinessunit.htm niceBusNo: 1234567 // Make sure this matches your NiCE CXone Business Unit Number. };

Step 3: Set up your Salesforce environment

You can integrate Agent Assist UI modules in a specific environment, such as production or development. Salesforce calls these environments organizations (orgs).

Configure your org with the Salesforce CLI

Follow these steps to use the Salesforce CLI to configure your org for Agent Assist integration.

  1. Run the following code and authenticate the CLI using the Salesforce login details you normally use.
    npm run login
  2. Run the following code to deploy the LWC to the org.
    npm run deploy

Step 4: Create an external client app

The Salesforce LWC uses the client credentials OAuth 2.0 flow to authenticate you. An external client app enables the client credentials flow. Use the app's consumer key and consumer secret to configure the Salesforce LWC to authenticate users with Salesforce.

  1. Navigate to the menu bar > Setup menu, then click Setup. In the Quick Find box, enter External Client App Manager.
    1. Click External Client App Manager > New External Client App > Create, then enter the following information.
    2. External Client App Name: lwc auth
    3. API Name: lwc_auth
    4. Contact Email: your_email@example.com
    5. API (Enable OAuth Settings) > Enable OAuth: Selected
    6. API (Enable OAuth Settings) > Callback URL: https://login.salesforce.com/services/oauth2/callback
    7. API (Enable OAuth Settings) > Selected OAuth Scopes: Access the identity URL service
    8. API (Enable OAuth Settings) > Enable Client Credentials Flow: Selected
    9. Click Create.
  2. Navigate to the menu bar > Setup menu, then click Setup. In the Quick Find box, enter External Client App Manager.
    1. Click your external client app's name > Edit.
    2. Navigate to OAuth Policies > OAuth Flows and External Client App Enhancements.
    3. Ensure Enable Client Credentials Flow is selected.
    4. For Run As, enter your login username.
    5. Click Save.
  3. Navigate to the menu bar > Setup menu, then click Setup. In the Quick Find box, enter External Client App Manager.
    1. Click your external client app's name > Edit.
    2. Navigate to OAuth Settings > App Settings > Consumer Key and Secret.
    3. Enter the verification code sent to your email.
    4. Copy the consumer key and consumer secret somewhere secure. You will need these for a later step.

Establish CORS and content security policies

  1. Navigate to the menu bar > Setup menu, then click Setup.
  2. In the Quick Find box, enter CORS, then click Edit.
    • Select Enable CORS for OAuth endpoints.
    • Click Save.
  3. Navigate to the menu bar > Setup menu, then click Setup.
  4. In the Quick Find box, enter Trusted URLs, then click New Trusted URL.
  5. Enter the following information:
    • API Name: ui_connector
    • URL: Enter the URL of the UI Connector Cloud Run Service endpoint you deployed with your Agent Assist Integration Backend. You can find this URL in the Cloud Run console. For example: https://<var>UI_CONNECTOR_SUBDOMAIN</var>.<var>GCP_REGION</var>.run.app.
    • CSP Directives: Select all checkboxes. Click Save & New.
  6. Enter the following information:
    • API Name: ui_connector_wss
    • URL: Enter the URL of the UI connector Cloud Run Service endpoint you deployed with your Agent Assist Integration Backend. You can find this URL in the Cloud Run console. Change the protocol to wss, for WebSockets traffic. For example: wss://<var>UI_CONNECTOR_SUBDOMAIN</var>.<var>GCP_REGION</var>.run.app.
    • CSP Directives: Select all checkboxes. Click Save & New.
  7. Enter the following information:
    • API Name: salesforce_domain
    • URL: Enter the URL of your Salesforce Domain with the following format: https://<var>YOUR_SUBDOMAIN</var>.my.salesforce.com.
    • CSP Directives: Select all checkboxes. Click Save.

Step 5: Install NiCE CXone Agent for Service Cloud Voice (BYOT)

Salesforce provides the add-on license Service Cloud Voice, which allows integration of third-party softphones with your Salesforce instance. NiCE CXone provides a Service Cloud Voice add-on called NiCE CXone Agent for Service Cloud Voice (BYOT). Follow NiCE's documentation to set up NiCE CXone Agent for Service Cloud Voice (BYOT) in your SCV-enabled Salesforce instance.

Step 6: Install the Salesforce Lightning Web Component

Follow these steps to use the Lightning Experience Editor to add the Salesforce Lightning Web Component into the contact page where NiCE CXone Agent for Service Cloud Voice (BYOT) opens when a new call comes in.

  1. Navigate to the Service Console.
  2. Sign in to NiCE CXone Agent for Service Cloud Voice (BYOT) in the utility bar.
  3. Call the NiCE POC number associated with the NiCE account you signed in with.
  4. Accept the incoming call. This should result in a new Voice Call record tab being opened.
  5. Click the Setup menu > Edit Page.
  6. Click Template > Change.
    • Select Header and Two Equal Regions.
    • Click Next.
    • Map each region to a new region.
    • Click Done.
  7. From the Components sidebar, move the agentAssistContainerModule into the sidebar. Note: The npm deploy command provided this component.
  8. Click the component you placed in the previous step and fill in the form fields as follows to add configuration details.
    • endpoint: The URL of your integration backend's UI connector. For example, a URL from the Cloud Run console, like: https://<var>UI_CONNECTOR_ENDPOINT</var>.<var>GCP_REGION</var>.run.app.
    • features: Agent Assist features to include. These must be enabled in your conversation profile. Some available features include CONVERSATION_SUMMARIZATION,KNOWLEDGE_ASSIST_V2, and AGENT_COACHING. Note that some features, like SMART_REPLY, are not available for voice.
    • channel: Indicate that the integration is voice.
    • platform: Indicate that the platform is servicecloudvoice-nice.
    • conversationProfile: Your Agent Assist conversation profile resource name. For example, projects/<var>GCP_PROJECT_ID</var>/locations/<var>GCP_REGION</var>/conversationProfiles/<var>CONVERSATION_PROFILE_ID</var>.
    • consumerKey: The external client app consumer key from step 4.
    • consumerSecret: The external client app consumer secret from step 4.

Step 7: Test the integration

You can test the voice integration with a test call to the Salesforce call center.

  1. Sign in to NiCE CXone Agent for Service Cloud Voice (BYOT) from the Omni-Channel widget in the Service Console's utility bar.
  2. Call your NiCE CXone POC number. You can find this in the NiCE CXone console.
  3. In your Service Console, accept the incoming call. The screen should open a new Voice Call record.
  4. In the Voice Call record, the Salesforce Lightning Web Component should load in the sidebar.
  5. Test both sides of the conversation, ensuring that Agent Assist transcription and features are working as you've configured them in your conversation profile in the Agent Assist console.