SAP Hybris Cloud for Customer CRM Events

Cloud Elements supports events via polling or webhooks depending on the API provider. For more information about our Events framework, see Events Overview.

Supported Events and Resources

Cloud Elements supports polling events for SAP Hybris Cloud for Customer CRM. After receiving an event, Cloud Elements standardizes the payload and sends an event to the configured callback URL of your authenticated element instance.

You can set up polling for the events resource. You can also copy the events configuration to poll other resources. See Configure Polling Through API for more information.

Note: Unless configured for a specific time zone, polling occurs in UTC.

Configure Polling Through the UI

To configure polling through the UI, follow the same steps to authenticate an element instance, and then turn on events. Select the resources to poll, and then click Create Instance. For more information, see Authenticate an Element Instance with Events (UI) or the element-specific authentication topic.

Configure Polling Through API

Use the /instances endpoint to authenticate with SAP Hybris Cloud for Customer and create an element instance with polling enabled.

Note: The endpoint returns an element token upon successful completion. Retain the token for all subsequent requests involving this element instance.

To authenticate an element instance with polling:

  1. Construct a JSON body as shown below (see Parameters):

    {
        "element": {
          "key": "sapc4ccrm"
        },
        "configuration": {
          "subdomain": "<domain>.crm.ondemand.com",
          "username": "<YOUR_SAP_Hybris Cloud for Customer_USERNAME>",
          "password": "<YOUR_SAP_Hybris Cloud for Customer_PASSWORD>",
          "event.notification.enabled": true,
          "event.notification.callback.url": "http://mycoolapp.com",
          "event.poller.refresh_interval": "15",
          "accounts": {
            "url": "/hubs/crm/accounts?where=ChangedOn>='${date:yyyy-MM-dd'T'HH:mm:ss'Z'}",
           "idField": "ObjectID",
           "datesConfiguration": {
             "updatedDateField": "ChangedOn",
             "updatedDateFormat": "milliseconds",
             "createdDateField": "CreatedOn",
             "createdDateFormat": "milliseconds"
           },
            "contacts": {
              "url": "/hubs/crm/contacts?where=ChangedOn>='${date:yyyy-MM-dd'T'HH:mm:ss'Z'}'",
              "idField": "ObjectID",
              "datesConfiguration": {
                "updatedDateField": "ChangedOn",
                "updatedDateFormat": "milliseconds",
                "createdDateField": "CreatedOn",
                "createdDateFormat": "milliseconds"
              }
            },
            "leads": {
              "url": "/hubs/crm/leads?where=ChangedOn>='${date:yyyy-MM-dd'T'HH:mm:ss'Z'}",
              "idField": "ObjectID",
              "datesConfiguration": {
                "updatedDateField": "ChangedOn",
                "updatedDateFormat": "milliseconds",
                "createdDateField": "CreatedOn",
                "createdDateFormat": "milliseconds"
              }
            },
            "opportunities": {
              "url": "/hubs/crm/opportunities?where=ChangedOn>='${date:yyyy-MM-dd'T'HH:mm:ss'Z'}",
              "idField": "ObjectID",
              "datesConfiguration": {
                "updatedDateField": "ChangedOn",
                "updatedDateFormat": "milliseconds",
                "createdDateField": "CreatedOn",
                "createdDateFormat": "milliseconds"
              }
            }
          },
        },
        "tags": [
          "ElementDocs"
          ],
        "name": "<AUTHENTICATED_INSTANCE_NAME>"
    }
    
  2. Call the following, including the JSON body you constructed in the previous step:

    POST /instances
    
    Note: Make sure that you include the User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.
  3. Locate the token and id in the response and save them for all future requests using the element instance.

Parameters

API parameters not shown in Cloud Elements are in code formatting.

ParameterDescriptionData Type
'key'The element key.
sapc4ccrm
string
Name
name
The name for the element instance created during authentication.string
Subdomain
subdomain
The url of your SAP Hybris Cloud for Customer CRM site. Replace in the default url with your own information.
UsernameYour user name for SAP Hybris Cloud for Customer CRM.String
PasswordYour password for SAP Hybris Cloud for Customer CRM.String
Events Enabled
event.notification.enabled
Optional. Identifies that events are enabled for the element instance.
Default: false.
boolean
Event Notification Callback URL
event.notification.callback.url
The URL where you want Cloud Elements to send the events.string
Event poller refresh interval (mins)
event.poller.refresh_interval
A number in minutes to identify how often the poller should check for changes.number
Configure Polling
"event.poller.configuration"
Resource to poll along with its configuration.JSON Object
accounts
"event.poller.configuration": "{\"accounts\"...}"
Optional
The SAP Hybris Cloud for Customer CRM accounts resource available for polling.
JSON object
contacts
"event.poller.configuration": "{\"contacts\"...}"
Optional
The SAP Hybris Cloud for Customer CRM contacts resource available for polling.
JSON object
leads
"event.poller.configuration": "{\"leads\"...}"
Optional
The SAP Hybris Cloud for Customer CRM leads resource available for polling.
JSON object
opportunities
"event.poller.configuration": "{\"opportunities\"...}"
Optional
The SAP Hybris Cloud for Customer CRM opportunities resource available for polling.
JSON object
tagsOptional. User-defined tags to further identify the instance.string

Example cURL

curl -X POST \
  https://api.cloud-elements.com/elements/api-v2/instances \
  -H 'Authorization: User <INSERT>, Organization <INSERT>'  \
  -H 'content-type: application/json' \
  -d '{
  "element": {
    "key": "sapc4ccrm"
  },
  "configuration": {
    "subdomain": "<domain>.crm.ondemand.com",
    "username": "<USERNAME>",
    "password": "<YOUR_SAP_Hybris Cloud for Customer_PASSWORD>",
          "event.notification.enabled": true,
          "event.notification.callback.url": "http://mycoolapp.com",
          "event.poller.refresh_interval": "15",
          "accounts": {
            "url": "/hubs/crm/accounts?where=ChangedOn>='\''${date:yyyy-MM-dd'\''T'\''HH:mm:ss'\''Z'\''}",
           "idField": "ObjectID",
           "datesConfiguration": {
             "updatedDateField": "ChangedOn",
             "updatedDateFormat": "milliseconds",
             "createdDateField": "CreatedOn",
             "createdDateFormat": "milliseconds"
           }
}
  },
  "tags": [
    "ElementDocs"
  ],
  "name": "<AUTHENTICATED_INSTANCE_NAME>"
}
'

Example Response

{
  "id": 50634,
  "name": "SAPHybris Cloud for CustomerAPI1",
  "createdDate": "2017-05-19T14:00:59Z",
  "token": "4RFxtlivv2BW9oAoO64wCnLvwwps4SPCf6LyCUq8Ihg=",
  "element": {
    "id": 5353,
    "name": "SAP Hybris Cloud for Customer CRM",
    "key": "sapc4ccrm",
    "description": "Add a SAP Cloud for Customer (Hybris Cloud for Customer) Instance to connect your existing SAP Cloud for Customer (Hybris Cloud for Customer) account to the CRM Hub, allowing you to manage accounts, contacts, leads, opportunities, etc. across multiple CRM elements. You will need your SAP Cloud for Customer (Hybris Cloud for Customer) account information to add an instance.",
    "image": "elements/provider_sapc4c.png",
    "active": true,
    "deleted": false,
    "typeOauth": false,
    "trialAccount": false,
    "resources": [],
    "transformationsEnabled": true,
    "bulkDownloadEnabled": true,
    "bulkUploadEnabled": true,
    "cloneable": true,
    "extendable": false,
    "beta": false,
    "authentication": {
      "type": "basic"
    },
    "extended": false,
    "hub": "crm",
    "protocolType": "odata",
    "parameters": [
      {
        "id": 3990,
        "createdDate": "2017-05-17T09:37:05Z",
        "name": "subdomain",
        "vendorName": "siteUrl",
        "type": "configuration",
        "vendorType": "path",
        "source": "request",
        "elementId": 5353,
        "required": false
      }
    ],
    "private": false
  },
  "elementId": 5353,
  "provisionInteractions": [],
  "valid": true,
  "disabled": false,
  "maxCacheSize": 0,
  "cacheTimeToLive": 0,
  "configuration": {  },
  "eventsEnabled": true,
  "eventsNotificationCallbackUrl": "http://mycoolapp.com",
  "subscriptionId": 1157990,
  "traceLoggingEnabled": false,
  "cachingEnabled": false,
  "externalAuthentication": "none",
  "user": {  }
}