Extending SAP Commerce with SCP Extension Factory & Twilio for SMS order updates
The aim of this blog is to demonstrate how to extend SAP Commerce using SCP (SAP Cloud Platform) Extension Factory, the new functionality showcased here is focused on sending SMS updates to customers for orders created in SAP Commerce, leveraging Twilio.
Twilio is a Cloud Communications Platform As A Service (cPAAS) whose Programmable SMS API helps to add robust messaging capabilities to any application.
Why do we need this?
SCP Extension Factory is an innovative extension framework available as part of the SAP C/4HANA suite. This framework plays a key role in extending the C/4HANA clouds through side-by-side extensibility. Hence, SAP Commerce could be extended in an event-driven, cloud-native way rather than the traditional way of java based extensions along with the benefits of efficiency, speed and independent deployments. For this POC I am using the Kyma runtime under the SCP Extension factory.
How does it work?
- Customer places an order in SAP Commerce
- SCP Extension factory consumes the order created event through the pre-built integration which triggers a serverless lambda function
- The lambda function reads the customer’s phone number from the order details and uses the Twilio APIs to trigger an SMS
- The customer gets an SMS on their recently placed order
The image below shows how this integration works
- Order updates via SMS capability in SAP Commerce
Setup in SAP Commerce Cloud
I have connected the SAP Commerce Cloud with SCP Extension factory through C/4HANA cockpit by following these links:
I customised the order.created event in SAP Commerce Cloud through the back office by adding 2 additional attributes to the event.
- Customer’s name
- Customer’s mobile number
Adding a new attribute in order.created event configuration
The set of attributes under order.created event will be passed to the event bus in Kyma when the order is placed in SAP Commerce.
Setup in Twilio
I created a trial account in Twilio (https://www.twilio.com/) and got the Twilio phone number, Auth token and Account SID by creating a sample project which is required for triggering an SMS message.
Implementation in SCP Extension Factory
After completing the setup in Kyma and SAP Commerce, I created a lambda function to process the order created event.
Below is the lambda function which utilises Twilio node.js APIs to send SMS to customers.
The node dependencies needed for this lambda function.
The environment variables that will be used within the lambda function.
Upon placing an order in SAP Commerce, I received an SMS on my phone from Twilio.
Extending SAP Commerce is much easier than before with the introduction of SCP Extension Factory. The key takeaways from this POC demonstration are how easy it has become to integrate a new system with SAP Commerce and extend its capability with very minimal code, easy configuration, no downtime and deployment.
Thanks for sharing such a nice use case via Kyma based SCPXF. Unfortunately, due to image re-size it is not possible to read through the image.
So, could you please re-attach the images without adjusting/compressing the size of them?
Thanks for your feedback, I have reattached the images, hope its better now.