Cloud Elements supports events via polling or webhooks depending on the endpoint. If you would like to see more information on our Events framework, please see the Event Management Guide.
Cloud Elements supports both webhooks and polling events for Salesforce.
You can set up events for the following resources:
created
, updated
, and deleted
data.You can configure polling through the UI or in the JSON body of the /instances
API call.
For more information about each field described here, see Parameters.
When finished adding your polling configuration, the Event Configuration section should look like this:
To add polling when authenticating through the /instances
API call, add the following to the configuration
object in the JSON body. For more information about each parameter described here, see Parameters.
{
"event.notification.enabled": true,
"event.vendor.type": "polling",
"event.notification.callback.url": "<INSERT_YOUR_APPS_CALLBACK_URL>",
"event.notification.signature.key": "<INSERT_KEY>",
"event.objects": "<COMMA_SEPARATED_LIST>",
"event.poller.refresh_interval": "<TIME_IN_MINUTES>"
}
event.notification.signature.key
is optional. instance JSON with polling events enabled:
{
"element": {
"key": "sfdc"
},
"providerData": {
"code": "<Code_On_The_Return_URL>"
},
"configuration": {
"oauth.callback.url": "https://www.mycoolapp.com/auth",
"oauth.api.key": "<Insert_Client_ID>",
"oauth.api.secret": "<Insert_Client_Secret>",
"event.notification.enabled": true,
"event.vendor.type": "polling",
"event.notification.callback.url": "https://staging.cloud-elements.com/elements/api-v2/instances/events",
"event.notification.signature.key": "12345",
"event.objects": "Contact,Account",
"event.poller.refresh_interval": "5"
},
"tags": [
"forDocs"
],
"name": "mySFDCInstance"
}
When implementing webhooks for Salesforce, Cloud Elements creates APEX classes and triggers in order to send webhooks. This can only be done in a Salesforce sandbox account. If you want to support webhooks in a production Salesforce account, you'll have to make some modifications and migrate those classes to production according to the Salesforce specification. View more information regarding the Salesforce specification.
You can configure webhooks through the UI or through API in the JSON body of the /instances
API call. First, you must set up webhooks in Salesforce.
Follow these steps to set up your Salesforce application with the endpoint.
Remote Site Settings
.For more information about each field described here, see Parameters.
When finished adding your polling configuration, the Event Configuration section should look like this:
To add webhooks when authenticating through the /instances
API call, add the following to the configuration
object in the JSON body. For more information about each parameter described here, see Parameters.
{
"event.notification.enabled": true,
"event.vendor.type": "polling",
"event.notification.callback.url": "<INSERT_YOUR_APPS_CALLBACK_URL>",
"event.notification.signature.key": "<INSERT_KEY>",
"event.objects": "<COMMA_SEPARATED_LIST>"
}
event.notification.signature.key
is optional. Instance JSON with webhooks events enabled:
{
"element": {
"key": "sfdc"
},
"providerData": {
"code": "<Code_On_The_Return_URL>"
},
"configuration": {
"oauth.callback.url": "https://www.mycoolapp.com/auth",
"oauth.api.key": "<Insert_Client_ID>",
"oauth.api.secret": "<Insert_Client_Secret>",
"event.notification.enabled": true,
"event.vendor.type": "webhooks",
"event.notification.callback.url": "https://mycoolapp.com",
"event.notification.signature.key": "12345",
"event.objects": "Contact,Account"
},
"tags": [
"forDocs"
],
"name": "mySFDCInstance"
}
API parameters are in code formatting
.
Parameter | Description | Data Type |
---|---|---|
'key' | The element key. sfdc |
string |
Namename |
The name for the element instance created during authentication. | Body |
oauth.api.key |
The Consumer Key from Salesforce. | string |
oauth.api.secret |
The Consumer Secret from Salesforce. | string |
Filter null values from the response filter.response.nulls |
Optional. Determines if null values in the response JSON should be filtered from the response. Yes or true indicates that Cloud Elements will filter null values. Default: true . |
boolean |
Events Enabled event.notification.enabled |
Optional. Identifies that events are enabled for the element instance.Default: false |
boolean |
Event Type event.vendor.type |
Optional. Identifies the type of events enabled for the instance, either webhook or polling . |
string |
Event Notification Callback URLevent.notification.callback.url |
For webhooks and polling.The URL where your app can receive events. | string |
Callback Notification Signature Key event.notification.signature.key |
For webhooks and polling.OptionalA user-defined key for added security to show that events have not been tampered with. This can be any custom value that you want passed to the callback handler listening at the provided Event Notification Callback URL. | string |
Objects to Monitor for Changesevent.objects |
For webhooks and polling.OptionalComma separated list of objects to monitor for changes. | string |
Event poller refresh interval (mins)event.poller.refresh_interval |
For polling only.A number in minutes to identify how often the poller should check for changes. | number |
tags | Optional. User-defined tags to further identify the instance. | string |