Introduction

The article describes the implementation of integration between the Kazoo VoIP (Voice over Internet Protocol) platform and Salesforce CRM. The solution was implemented by the JazzTeam project team for a commercial provider in Europe.

Initial Task

Initial task – Salesforce CRM users should be able to use VoIP services, such as:

  • calling a subscriber by phone number;
  • receiving incoming calls;
  • viewing call history;
  • listening to call recordings, etc.

All actions should be performed within the Salesforce CRM interface.

Existing Salesforce API Capabilities for Integration with VoIP Platforms

Salesforce OpenCTI

Salesforce OpenCTI is a Javascript API that allows you to use third-party VoIP services in the Salesforce platform.

With OpenCTI, you can make telephone calls (using a softphone) directly in the Salesforce platform’s web interface without installing computer-telephony integration (CTI) adapters on your local machine (see figure 1).

You can find the details and learn about all OpenCTI API methods here.

Interaction of OpenCTI with other components
Figure 1. Interaction of OpenCTI with other components.
The image is taken from https://developer.salesforce.com

Salesforce Call Center

Salesforce Call Center integrates third-party softphones with Salesforce platform. Call Center allows setting the URL of the softphone application, which will appear in a footer of the console and in Lightning Experience (see figure 3). With Call Center, you can manage the access of individual users to the softphone features. The web application, which is selected in Call Center as a softphone, will be displayed in a special frame and will be able to work with OpenCTI API through the connected opencti.js library.

JazzTeam Solution

Defining Project Requirements

The JazzTeam project team, together with the customer, identified the following list of requirements for VoIP integration into Salesforce:

  1. Saving call history in Salesforce.
  2. Displaying a pop-up window with information about the active call.
  3. Keeping the call recording with the possibility to listen to this recording in Salesforce.
  4. Making the integration setup process as simple as possible for the end user.

Analysis of Existing Commercial Solutions

After defining the requirements, we conducted an in-depth technical analysis of existing solutions for integrating VoIP services into Salesforce. The purpose of the analysis was to study the existing approaches to integration with Salesforce. We analyzed:

  • Zadarma.
  • Twilio.

Results of the analysis: The existing integrations of VoIP services with Salesforce use a similar approach to creating their own softphone based on a call management web application. For additional settings, such as sending different tokens to Salesforce, additional tabs with settings are created. If integration includes working with data, then tabs are created to work with it. The WebSocket connection is used to display the active call card. The softphone receives the event and displays information about the ongoing call in real time.

Design and Development

Architecture Solutions

After analyzing the market, we made the following decisions:

  1. To develop our own version of Salesforce softphone. Since Salesforce doesn’t provide out-of-the-box solutions, but only an API and the possibility to place our web application in a frame on the main screen.
  2. To create a new Custom Object in Salesforce – KazooCallData, for storing information about calls. The KazooCallData object is flexible for use in custom user integrations within Salesforce.
  3. To use Visualforce as a framework for developing the softphone. Visualforce has good technical support and minimal restrictions when calling Apex code through the OpenCTI API in managed package.
  4. To save all information about calls through Salesforce REST API for the Custom Object.
  5. For implementation of pop-up windows in Salesforce during the active call we use PushTopic events. This mechanism allows subscribing to notifications for changes to Salesforce data that match an SOQL query via the Cometd protocol. We got interested in the possibility to filter call records by Owner Id, i.e., by a particular user. This allows the softphone to subscribe to notifications only about these calls that are associated with a Salesforce account user.

Diagram

The simplified architecture diagram of our application is shown in figure 2:

Architecture diagram of Kazoo integration into Salesforce
Figure 2. Architecture diagram of Kazoo integration into Salesforce

Events Handling

  1. Integration App (data processing app) subscribes to events with information about calls in Kazoo.
  2. Integration App converts events from Kazoo to a normal call format (call initialization, user answered the call, end of call, etc.). It is necessary because events contain information about call channels between Kazoo and subscribers.
  3. Information about calls is saved in KazooCallData via Salesforce REST API.
  4. The softphone (when a Salesforce session is active) subscribes to notifications about changes in the object’s KazooCallData.
  5. If a softphone receives a notification about a new record in KazooCallData (e.g. about a new call), the OpenCTI API is called to display the softphone’s window on the Salesforce page. This window shows information about the call: call status, subscriber’s number, call timer.

Events History and Call Recording

A softphone user can view the calls history and listen to the audio recording of a call. This is implemented using the OpenCTI API, which makes calls to Apex code. For that, we created the Apex class, which uploads data from the KazooCallData object. The softphone, when it opens, sends a query to this class and displays the received information.

The UI part of IP telephony implementation in the Salesforce interface
Figure 3. The UI part of IP telephony implementation in the Salesforce interface

Setting Up

The integration setup is limited to the fact that the company’s Salesforce administrator only needs to install the package with the softphone code and give access to users through Salesforce Call Center.

It is enough to give a user access just to the Salesforce REST API. This is implemented by clicking on the integration button in the provider’s VoIP application.

Links to Detailed Information

Conclusion

The integration of VoIP/CTI services into Salesforce was successful. The success prerequisites were:

  1. Our company’s previous experience in this sphere (in particular, VoIP integration with Zoho CRM).
  2. Well-designed product architecture – for Salesforce we only created a specific softphone and an adapter to the existing universal integration application, which was developed earlier during the integration with Zoho.