Salesforce
- Introduction
- Create an app at Salesforce
- Create the Salesforce service in Cerb
- Link the connected account to Salesforce in Cerb
- Examples
- Use the connected account in bot behaviors
Introduction
In this guide we'll walk through the process of linking Cerb to Salesforce. You'll be able to use the full Salesforce API from automations in Cerb to automate whatever you need.
Create an app at Salesforce
Next, you need to create a new app on Salesforce for Cerb to connect to.
Log in to Salesforce.
In Salesforce Classic
-
Click Setup in the top right.
-
In the Build menu on the left, expand Create and select Apps.
-
In the Connected Apps section at the bottom, click the New button.
In the Lightning Experience
-
Click the gear icon in the top right and choose Setup
-
Under Platform Tools in the menu on the left, click Apps » App Manager
-
Click the Create Connected App button in the top right.
-
Choose Create a Connected App and click Continue
Configure Basic information
Enter the following details:
- Connected App Name:
Salesforce for Cerb
- API Name:
Salesforce_for_Cerb
- Contact Email: (your email address)
-
Logo URL: image
Configure OAuth
In the API (Enable OAuth Settings) section:
- Enable OAuth Settings: yes
- Callback URL:
https://YOUR-CERB-HOST/oauth/callback
- Selected OAuth Scopes:
- Perform requests on your behalf at any time (refresh_token, offline_access)
- Access and manage your data (api)
- Provide access to your data via the Web (web)
Copy your OAuth credentials
-
Scroll to the bottom and click the Save button.
-
Click the Continue button.
-
Click Manage Consumer Details
-
Make a note of your Consumer Key and Consumer secret. You'll need them in the next step.
Create the Salesforce service in Cerb
-
Navigate to Search » Connected Services.
-
Click the (+) icon in the top right of the list.
-
Select Salesforce.
-
Enter your Client ID and Client Secret.
-
Click the Create button.
Link the connected account to Salesforce in Cerb
-
Navigate to Search » Connected Accounts.
-
Click the (+) icon in the top right of the list.
-
Select Salesforce.
-
Click the blue Link to Salesforce button.
-
Accept consent on Salesforce.
-
Click the Save Changes button.
It may take up to 10 minutes for your new app to be available in Salesforce. If you have trouble with the OAuth authentication step, wait a few minutes and try again.
Examples
Create an Account record
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm
start:
http.request/createAccount:
output: http_response
inputs:
method: POST
url: https://YOUR.SALESFORCE.DOMAIN.my.salesforce.com/services/data/v63.0/sobjects/Account/
headers:
Content-Type: application/json
authentication: cerb:connected_account:salesforce
body:
Name: Testerson LLC
NumberOfEmployees: 5
Industry: Testing
on_success:
set:
response@json: {{http_response.body}}
http_response@json: null
Get Account info
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_get_field_values.htm
start:
http.request/createAccount:
output: http_response
inputs:
method: GET
url: https://YOUR.SALESFORCE.DOMAIN.my.salesforce.com/services/data/v63.0/sobjects/Account/ABCDEF12345?fields=Name,NumberOfEmployees,Industry
headers:
Content-Type: application/json
authentication: cerb:connected_account:salesforce
on_success:
set:
response@json: {{http_response.body}}
http_response@json: null
Update an Account record
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm
start:
http.request/createAccount:
output: http_response
inputs:
method: PATCH
url: https://YOUR.SALESFORCE.DOMAIN.my.salesforce.com/services/data/v63.0/sobjects/Account/ABCDEF12345
headers:
Content-Type: application/json
authentication: cerb:connected_account:salesforce
body:
BillingCity: Testerville
on_success:
set:
response@json: {{http_response.body}}
http_response@json: null
Use the connected account in bot behaviors
You can use the connected account you just created to access the Saleforce REST API from bot behaviors in Cerb. This is typically accomplished using the Execute HTTP Request action from a bot, and selecting the connected account in the Authentication: section.
You can import the Salesforce Bot package for a working example.