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:
- Salesforce Developer Account
- Salesforce SOQL Workbench
- JSON formatter
- Demo Server
- Demo Portal
- 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 stepb. In workbench query page
SELECT Name,Email,AccountId FROM ContactResult :
Name Email AccountId Rose Gonzalez rose@edge.com 0012w00001FWbG9AAL SELECT Name,Email,Account.Name,Account.Id,AccountId FROM ContactResult :
Name Email Account. Name AccountId Account. Id Rose Gonzalez rose@edge.com Edge Communications 0012w00001FWbG9AAL 0012w00001FWbG9AAL 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:
How to Add a Custom Field in Salesforce (Lightning Experience)
Step 1: Add custom fields to the Activity and User objects:
- Activity fields :
| Field Label | Field Name | DataType |
|---|---|---|
| Gcalls Call Duration | Gcalls_Call_Duration__c | Number(18,0) |
| Gcalls Call Flowid | Gcalls_Call_Flowid__c | Text(100) |
| Gcalls Call Status | Gcalls_Call_Status__c | Text(100) |
| Gcalls Call Type | Gcalls_Call_Type__c | Picklist (Note : Enter values Inbound , outbound) |
| Gcalls Customer Phone | Gcalls_Customer_Phone__c | Phone |
| Gcalls End Time | Gcalls_End_Time__c | Date/Time |
| Gcalls SMS Content | Gcalls_SMS_Content__c | Text(255) |
| Gcalls Start Time | Gcalls_Start_Time__c | Date/Time |
| Gcalls URL Recorder | Gcalls_URL_Recorder__c | URL(255) |
| Gcalls_ActivitId | Gcalls_ActivitId__c | Text(255) |
- User fields :
| Field Label | Field Name | DataType |
|---|---|---|
| Gcalls Extension | Gcalls_Extension__c | Text(255) |
| Gcalls Password | Gcalls_Password__c | Text(100) |
| Gcalls Proxy | Gcalls_Proxy__c | Text(255) |
| Gcalls Websocket | Gcalls_Websocket__c | Text(255) |
Step 2: Create a Salesforce Lightning app with an OpenCTI component
Watch a Demo:
How to Create a Lightning App in Salesforce (Lightning Experience)
Configure the Following Settings :
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.
- In Utility Items, select Open CTI Softphone and click Next
- Select Navigation Items, then select User Profile. Finally, click on "Save and Finish" to exit the wizard
- Check your new app in App Launcher
Step 3: Setup Apex code to get user infomation
In Salesforce, access the Developer console. Select File > New > Apex Class :
Class name: RCPhoneHelperCopy the RCPhoneHelper from gcalls-shell/market-driven/Salesforce repo and paste it into the file
Create a new class with name RCPhoneHelperTest and copy RCPhoneHelperTest then paste it into the file
To save changes made in the file, click on the File > Save All
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
- Download call-center.xml
- 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)
- 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
- 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)
- 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
- 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
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
- 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})**
- Host : yoursalesroce.host.com (Example : my.salesforce.com)
- Description : Your description
- Info : manage the functionality for objects. Please review the topic of JSON Integration Data and visit the demo portal to view a sample setup
- 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
- Fields : Salesforce Account Information
Step 7: Create an integration folder
- 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
- 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