Select Page

The headless approach in commerce is no longer an option, businesses more often need omnichannel purchasing and inventory management experiences not just on the customer side of the system, but through any phase of the system lifecycle. There are a number of Commerce Systems on the market today that allow for omnichannel ordering strategies and headless integrations, but there is only one system that combines personalized user experience, a single development process across all components of the platform, and supports headless integration at any phase of the user journey.

The obvious solution to most omnichannel integrations will be Sitecore JSS, this is a great Sitecore JavaScript SDK, with support for decoupled development and can be consumed by a range of clients, from Mobile Apps to SPAs. The SDK went through a few major transformations since I first got my hand on the concept back in 2017. It is enterprise-ready now and a great platform for building decoupled solutions. There number of great articles written on how to use Sitecore JSS, not to mention top-class documentation, created by Sitecore. In this article, I would want to explore an approach of integrating Sitecore customer-facing clients using a Reactive Programming Approach. With the goal to build a responsive, resilient, and event-driven system, where our system behaves based on the “Hollywood Principle” – “Don’t call us, we’ll call you”, or Observer Pattern to help us decouple Sitecore from our potential client applications, no matter what and where they are. The only and one requirement, the client should be able to participate in the event-driven process.

Sitecore XC9 Diagram

To enable the even-drive model, we need to define an input mechanism for Sitecore Order messages, we also need to define a process for subscribing a client to notification pipeline. In my example, I’ve used IoT Device as a client and naturally, IoT Hub was used for establishing messaging flow , but Service Bus, Event Grid or even HTTP hook are excellent options, depends on the client used. The message can be pulled-by or pushed-to Azure Logic App Pipelines for processing. Logic App would not just be responsible for message processing, it’ll be orchestrating ordering process, would notify uses and monitor Sitecore for order status changes and will push data for analytics analysis.

Logic App

On the Sitecore side, the ordering mechanism will be supported by Commerce Connect Abstract Service layer API which already has most APIs available, but it can be easily extended to support custom end-points, running on top of Commerce Connect. We will need to integrate Sitecore’s internal messaging routines with Azure Logic App to enable subscriber model, where Sitecore would raise an event(using Event Grid, for example ) to notify clients of a change, and we will use Sitecore’s Order API to get data into Logic App. To ensure the security of the purchasing process, Sitecore’s standard authentication approach will be used. The JWT token will be retrieved from the Identity server and passed to subsequent API calls in the header of each request. To place an order over a single end-point, I’ve created a simple order orchestration plugin that combines: CartLineComponent, PhysicalFulfillmentComponent, and FederatedPaymentComponent. Azure functions are a great choice for integrating Sitecore APIs with Azure infrastructure over HTTPS protocol.

I fully expect Sitecore JSS to be used by the majority of Sitecore Commerce Headless integrations, but in a case where you want to connect a special client or use your commerce solution with IoT, using the Commerce Connect Abstract Service layer with Azure SaaS functionalities is a great way to go. The Sitecore plug-and-play APIs and Azure’s SaaS components allow for almost codeless integration of any clients with Experience Commerce.