Skip to main content

Salesforce Integration

Feb 03, 2023

There are various ways to integrate with Salesforce, however, in these instructions, we will only focus on the Salesforce Connected and Lightning app

Getting started

I. Prerequisites

Before integrating Gcalls into Salesforce, ensure that you have the following items:

  1. Salesforce Developer Account
  2. Salesforce SOQL Workbench
  3. JSON formatter
  4. Demo Server
  5. Demo Portal
  6. Git repository

II. Integration

To integrate Gcalls into Salesforce, follow these step by step:

1. Sign up, Login, SOQL Practice

  • Step 1: Sign up a developer account or ask your teammate

  • Step 2: Login to Salesforce with your developer account

  • Step 3: Login to SOQL Workbench with your developer account

    a. In workbench select page

    Jump to: SOQL query
    Object: Contact
    > Click on 'Select' then proceed to the next step

    b. In workbench query page

    SELECT Name,Email,AccountId FROM Contact

    Result :

    NameEmailAccountId
    Rose Gonzalezrose@edge.com0012w00001FWbG9AAL
    SELECT Name,Email,Account.Name,Account.Id,AccountId FROM Contact

    Result :

    NameEmailAccount. NameAccountIdAccount. Id
    Rose Gonzalezrose@edge.comEdge Communications0012w00001FWbG9AAL0012w00001FWbG9AAL

    This section will provide you with an understanding and basic insight into the relationships between Salesforce objects.

2. Integrating Gcalls into Salesforce

Login to your Salesforce account. At the top of the page, click on the Setup icon. Then, navigate to the Object Management Settings.

Watch a Demo: Watch Video Demo How to Add a Custom Field in Salesforce (Lightning Experience)

Step 1: Add custom fields to the Activity and User objects:

  • Activity fields :
Field LabelField NameDataType
Gcalls Call DurationGcalls_Call_Duration__cNumber(18,0)
Gcalls Call FlowidGcalls_Call_Flowid__cText(100)
Gcalls Call StatusGcalls_Call_Status__cText(100)
Gcalls Call TypeGcalls_Call_Type__cPicklist (Note : Enter values Inbound , outbound)
Gcalls Customer PhoneGcalls_Customer_Phone__cPhone
Gcalls End TimeGcalls_End_Time__cDate/Time
Gcalls SMS ContentGcalls_SMS_Content__cText(255)
Gcalls Start TimeGcalls_Start_Time__cDate/Time
Gcalls URL RecorderGcalls_URL_Recorder__cURL(255)
Gcalls_ActivitIdGcalls_ActivitId__cText(255)
  • User fields :
Field LabelField NameDataType
Gcalls ExtensionGcalls_Extension__cText(255)
Gcalls PasswordGcalls_Password__cText(100)
Gcalls ProxyGcalls_Proxy__cText(255)
Gcalls WebsocketGcalls_Websocket__cText(255)

Step 2: Create a Salesforce Lightning app with an OpenCTI component

Watch a Demo: Watch Video Demo How to Create a Lightning App in Salesforce (Lightning Experience)

Configure the Following Settings :

  1. Navigation Style: Console navigation

    Note: Standard navigation shows items in a navigation bar at the top of the page. Console navigation opens each record in a new workspace tab.

  1. In Utility Items, select Open CTI Softphone and click Next
  2. Select Navigation Items, then select User Profile. Finally, click on "Save and Finish" to exit the wizard
  3. Check your new app in App Launcher

Step 3: Setup Apex code to get user infomation

  1. In Salesforce, access the Developer console. Select File > New > Apex Class :

    Class name: RCPhoneHelper

  2. Copy the RCPhoneHelper from gcalls-shell/market-driven/Salesforce repo and paste it into the file

  1. Create a new class with name RCPhoneHelperTest and copy RCPhoneHelperTest then paste it into the file

  2. To save changes made in the file, click on the File > Save All

  3. To run tests in Salesforce, click on Test > Run All.

    If all tests pass without errors, the test has been successfully completed

Step 4: Create a call center in Salesforce

  1. Download call-center.xml
  2. To import Call Centers in Salesforce, go to Setup, type "Call Centers" in the Quick Find search bar, select Call Centers from the results, and then click on the Import button
  • After creating the Call Center record in Salesforce, it should be visible in the Call Center page

    Note: change the CTI Adapter URL to the production URL)

  1. To add a call center user in Salesforce:
  • Click on call center record > Manage Call center Users > Add more User > find and select salesforce users who should be enabled as call center agents

Step 5 : Create a Connected App

  1. From Setup > enter App Manager in the Quick Find box > select App Manager > then click on "Create New Connected App" at the top of the page
  • Fill in the required fields and click "Save"
Connected App Name   : Gcall Integration
API Name : Gcall_integration
Contact Email : developer@gcalls.co
Enable OAuth Setting : true
Callback URL : http://localhost
Selected OAuth Scopes: Full access (full)
  1. From Setup > enter Connected Apps in the Quick Find box, select Manage Connected Apps > find your new connected App > select Manage > edit Policy > Save
IP Relaxation   : Relax IP restrictions
Permitted Users : All users may self-authorize

  1. From Setup > enter Connected Apps in the Quick Find box, select Manage Connected Apps > find your new connected App > select View
  • API (Enable OAuth Settings) > Consumer Key and Secret > click on Manage Consumer Details > generate Consumer Key And Secret
  1. Get your token from consumer key and secret
curl https://login.salesforce.com/services/oauth2/token -d 'grant_type=password&client_id=3MVG9Y6d_Btp4xp5OkM1b4zt4n4eqn2.VASD8jhibLV4goD.76u54WjIqaJwXtK29roDJfFFTTTTX0EO_f84q&client_secret=7894561272718739647&username=salesforcecodes@test.com&password=passwordValueSecurityToken' -H "X-PrettyPrint: 1"

Result :

  "access_token" : "00D2w00000Ksypp!ARsAQFT_hyxwityyQt6m4JV0ieyDdHzaUYkzptgN1.7YjwXw2y0D4DSQGVmXIx2aOYinGd_LsuII_TwRwEoivX4z4SNQ1_W1u",
"instance_url" : "https://gcalls-dev-ed.develop.my.salesforce.com",
"id" : "https://login.salesforce.com/id/00D2w00000KsyppEAB/0052w00000C53pLAAR",
"token_type" : "Bearer",
"issued_at" : "1675400977823",
"signature" : "+yfMxMO9toK0HiSuTscu8Uw4oKtRErRo1A6hOFQGJpM="
}
Save your access token to use later

Step 6 : Add integrator

Login to https://portal.gcalls.vn to access the portal > Customer > Integration > find integration named 'salesforce' > cLick on the "eye" icon > cLick Add integrator

  1. ID Callcenter

Access the "demo server" > find callcenter named 'gcallstest' > Retrieve the call center ID

$ mongo
$ use third-party-service
$ db.integrator.find({host: “[https://my.salesforce.com](https://my.salesforce.com/)”}, {_id: 1})**
  1. Host : yoursalesroce.host.com (Example : my.salesforce.com)
  2. Description : Your description
  3. Info : manage the functionality for objects. Please review the topic of JSON Integration Data and visit the demo portal to view a sample setup
  4. Iframe : render the UX/UI for objects, the fields of the object you wish to display and load data from the 'Info' section. Please review the topic of JSON Integration Data and visit the demo portal to view a sample setup
  5. Fields : Salesforce Account Information

Step 7: Create an integration folder

  1. Clone the callbox repo repository:
$ cd gcallsfront/callbox/src/customCallbox/salesforce
$ ls

Result :
--62e206a54e4a1c0d633bdaea
--6306f68af2566a2336d42117
--63a4269b102e1b9759a12c2b

+ Each integration should have a unique hash name folder
  1. Create a folder for your Salesforce integration
  • Login to Salesforce using the Google Chrome browser.
crt + shift + j

You will see the name of the integration folder