Headless E-Commerce Integration with Commercetools and Synesty

A practical use case how to connect the headless commerce platform Commercetools to other systems - with Synesty.

Headless E-Commerce Integration with Commercetools and Synesty

In our tutorials we regularly present application examples, APIs and connectors that can be connected with native features of Synesty, without there being a ready-to-use Synesty add-on yet.

Microservices, API-first, headless and cloud-native are some of the buzzwords that describe the platform commercetools. Without going into too much detail, this is understood to mean (in very simple terms) an e-commerce platform without a web (store) front end. Instead, the platform has only APIs for managing products and orders. The front end can then be connected by each company itself in a technology of its choice. This way offers an enormous amount of flexibility to design one's own e-commerce landscape individually and independently of specific technologies. This has also been recognized by well-known customers such as Audi, AT&T or Danone, who rely on commercetools in their e-commerce strategy.

The API-first approach of commercetools is of course also exciting for Synesty to connect different tools and systems to commercetools.

In this article we want to show exemplarily how to export products and orders from commercetools with simple board tools from Synesty and the API-Connector-Tools. This is useful e.g. for the creation of product data feeds or the integration of ERP backend systems to which the orders should be exported.

The commercetools Backend

Of course, despite API-first and headless, there is also a web interface where you can manually perform various administrative tasks. For the test integration in this article, this includes:

  • Setting up API key for communication with the REST API interface (ClientID and Client Secret).
  • Creation of products
  • Creating orders

Set up API access with Synesty

The commercetools API uses the OAuth2 ClientCredentials Authentication, which can be configured in Synesty as HTTP account.

For this purpose you have to create an HTTP account with the following data:

Clicking on "Start configuration" will then populate the access token needed for the API calls.

Export Products

To export products, we create a simple demo flow. This consists of URLDownload and a JSONReaderVisual. The URLDownload makes the HTTP request to the /products API endpoint and the JSONReaderVisual reads the JSON response and extracts the fields you need.

The result is a spreadsheet with various columns from the product data. The flow can now be extended and the data transferred to an external system through further steps.

Since we have read out the stock of the products in the above example, we transfer it to another e-commerce system for a stock update - in this example Tradebyte Set Stock. For this purpose, the two columns referenceID and stock relevant for Tradebyte were mapped and filled with the data from commercetools.

Damit wäre ein vereinfachter Flow für ein Bestandsupdate von commercetools zu Tradebyte fertig und könnte automatisiert werden, um den Warenbestand z.B. stündlich zu aktualisieren.

Export Orders

At least as important, if not more important, are the orders. Since the store system often does not handle full fulfillment, the order data is exported to other backend systems such as ERP or fulfillment service providers.

We also show an example of this process below.

The flow works very similar to the product export, except that we go to the /orders API endpoint. However, since orders have a two-step structure of orders and order items, we use the APICall Step here. This step has the advantage of providing more options through scripting to read in this two-level data.

The parsing template shows an example of how to read the order lines with the corresponding lineItems. With a subsequent mapper, you can remove all fields that you do not need and create a CSV file for the ERP, for example.

Finally, you need to consider how the external system should receive the data. From (S)FTP transfer to S3 storage, Google Drive, One Drive, Dropbox or another API, everything is conceivable. There is a whole range of ready-made add-ons.

Summary

API-first, headless, no code integration and automation are quite a lot of buzzwords, but they fit together very well. We hope we could give you a feeling by the practical examples how you can use Synesty as middleware / interface between commercetools and other software systems.

Of course, the integration shown only scratches the surface of the possibilities. If you want to try out what is shown yourself, you can start with our template.

View Template

Feel free to contact us if you would like to learn more.

More Information

Our whitepaper for Makers: No Code Integration & Automation

Related articles


Last updated October 12, 2022
Chat with us