2 min read
Extending SAP CX Solutions using SCP Extension Factory
13 February 2020
Qazi Murtaza
How to extend SAP Commerce Cloud and SAP Marketing Cloud using SAP Cloud Platform Extension Factory (XF)
For the purpose of this walk-through, our example application flow would be:
- SAP Commerce generates an event (review.created) when a customer leaves a review for a product
- Lambda running under Kyma runtime executes on (review.created) event which receives the customer, order, and reviews details in the event payload
- Lambda processes the payload and sends review text to third party sentiment analysis service
- Sentiment results received from third party services are sent to SAP Marketing Cloud for targeted campaigns and other forms of marketing

You can use SAP CX Foundation, together with open-source project Kyma as infrastructure, to extend SAP CX products and third-party products. These components provide a Kubernetes-based environment to build, run, and host cloud-native, event-based extensions. The overall process is as follows:
Bring your cloud provider access credentials
The extensibility concept for SAP CX is based on the “Bring Your Own License” (BYOL) model for Kyma runtimes. In this model, you provide access credentials for your subscription from either Google Cloud Platform or Microsoft Azure. These credentials are then used to provide the runtime in your cloud provider subscription. In our case, our Kyma (Kubernetes cluster) runtime is provisioned and hosted on Google Cloud Platform.

Provision a runtime
A runtime is a Kubernetes cluster on which Kyma is installed and configured to provide the environment for developing and running your extensions.

Register SAP CX products with “Kyma” runtimes
Establish a secure connection between your runtime and the SAP CX product you’re extending. This involves registering the product, copying a token from the runtime, and then making the token available in the SAP CX product. The result is that all services and events exposed by the product are propagated to the runtime.
In this case, we will use the following steps to connect our runtime with both SAP Commerce Cloud and SAP Marketing Cloud:
A. Generate a token for each of the SAP CX products required.



B. Create and select the namespace where the Lambdas will reside.

C. Connect the CX products by pasting the tokens generated earlier. This is to enable a secure connection between CX products and Kyma.

D. Once connected, the portal will show the services and events provided by the CX products, these services and events can be utilised to trigger the Lambdas.

Access runtimes using the Kyma Console link available in the cockpit and start developing extensions
A. In our case we have a couple of Lambdas for reviewing and emplacement; former is to post review text to sentiment analysis service while the latter is to send the sentiment to SAP Marketing Cloud.


