FAIR Consulting Group Contentful Integration with SAP Hybris Commerce - FAIR Consulting Group

Contentful Integration with SAP Hybris Commerce

Share on facebook
Share on twitter
Share on linkedin

Contentful Integration with SAP Hybris Commerce

Overview

This document will explain Contentful integration with SAP Hybris which includes implementation of Mulesoft as a Middleware for routing and transforming messages.

The behaviour of this implementation will work as an application where content writers can insert some content for products and categories in Contentful which will be pushed to SAP Hybris passing through Mulesoft.

How This Integration Works

The diagram below shows exactly how this integration will work:

There’s some explanation for the flow of integration defined below:

  1. Content writer adds/modifies content in Contentful Entry
  2. Entry is then triggered by Contentful Webhook
  3. Webhook then notifies Mulesoft with payload transforms Contentful payload to Hybris payload
  4. Mulesoft requests Hybris Platform Webservices with payload as body to insert category or product
  5. Hybris Platform Webservices then persists data in Hybris platform and in response status code is sent to Contentful Webhook Passing through Mulesoft.

Technical Implementation

There are a couple of steps to prepare systems before integration:

  • Prepare Systems
  • Integrate Systems

Prepare Systems

1. Contentful

  • Create a Contentful CMS account and then a “space” inside your account
  • Create a “content model”(Category) and add “fields” in that model which is a sort of Database table and columns
  • Create some “content entries” in that model which can be supposed as Table Row

Let’s suppose there are 3 fields in a content model named Category which should look like the image below;

2. SAP Hybris Commerce

  • Create catalog and catalog versions which would contain category and products
  • Add platform web services extension in localextensions.xml
  • ant clean all and verify if platform web services extension is working

3. Mulesoft

  • Create an application project in mulesoft
  • Create a flow and chain defined connectors

1. HTTP Listener

– This will behave as the entry point of the flow and will be used to receive payload from Contentful webhook

2. HTTP Request

– This will be used to request and receive full payload for the particular category including its supercategories from Contentful

3Transform

– This will be used to transform Contentful payload to Hybris payload

4. HTTP Request

– This will be used to send data to SAP Hybris Commerce

Integrate Systems

1. Configure Settings in Contentful Application for Integration

  • Create Webhook in Contentful Application and go to Settings → Webhooks
  • Configure settings as defined in images below

Note :

  • URL field should be cloud hub URL where Mulesoft Application is deployed before /category
  • As defined in the image, this webhook is configured for the entry of Category content type
  • Now when any record is inserted in Category model at the same time this Webhook would be triggered and data of that entry would be sent to Mulesoft

2. Configure Settings in Mule Application for Integration

Now we’ll configure connectors in Mulesoft Application which were created in “Prepare Systems” section

1. HTTP Listener

– Define method as POST

– Define path as /category

2. HTTP Request

– Define method as GET

– Define URL as:

https://cdn.contentful.com/spaces//entries/?access_token=&content_type=category&include=1&fields.categoryCode=payload.fields.categoryCode."en-US"

– Define Request body as payload

3. Transform

– Transform Contentful payload to Hybris payload

4. HTTP Request

– Define method as PUT

– Define URL as

https://{host}/ws410/rest/catalogs//catalogversions//categories/payload.code

Mule flow should look like this

Once done with the steps defined above, Add any entry for category content type in Contentful then Publish it, and go to Hybris Backoffice to verify the category.

Summary

As this integration works perfectly fine for products and categories models for SAP Hybris, using Mulesoft was an idea to not make any basic customisations in Hybris however it can be achieved using Contentful API libraries like CMA and CDA by customizing Hybris Service layers and CronJobs. This Integration can be enhanced to make it work for assets integration for which there might be some customization required in Hybris to import external media.

Related Insights

Stay up-to-date with FAIR

Connect with FAIR today and get the latest tips and tricks on improving your customer experience tools and eCommerce platforms. Once you subscribe you will get access to workshops, webinars, recent projects and so much more.