Background
Following on from the previous blog post where we demonstrated a custom workflow acting as an interface between Umbraco Forms and the CRM provider HubSpot, this second article in the series introduces another new package providing a further example of such an integration.Â
As before, we are releasing the package, source code, and this explanatory blog post in an attempt to highlight the various ways Umbraco can be integrated with other providers, as part of a composable DXP solution. You are welcome to use the package directly, or just peruse the source code and use it as inspiration for similar integrations you may need to tackle in your own projects.
The full source code is also available here on GitHub. And just repeating the caveat from last time - we’re happy to take PRs and respond to issues, but please be aware that this isn’t a supported Umbraco product. It’s more of an MVP in this first version that we’d like to make available to the community.
If what you see here looks immediately useful, you can reference and use the integration in your own project, as the package is available both on NuGet and on Our Umbraco.
Credit and thanks for much of the work here go to Søren Kottal and Ecreo.
Â
Working with CommerceTools
CommerceTools is a provider of e-commerce solutions, integrated headlessly into web and mobile applications. Store managers will work with a back-office provided by CommerceTools, known as the “Merchant Center”, where the commerce-related administration functions such as product setup and order management are performed. The commerce data is then surfaced via an API, through which it can be integrated into customer websites and applications.
The provided API is much as you’d expect - with well documented, REST-based endpoints, accessible via an OAuth token flow.
In the example we’re providing here, we’ve used these APIs to build a custom property editor, allowing an editor to pick a CommerceTools provided product or category and associate the identifier of the selected item with an Umbraco content item. We then have a property value converter that converts that identifier into a strongly typed model, which is hydrated via a further API call and can be used for rendering to a page or including in a further API response.
Â
Building the Custom Property Editor
When compared to the previously blogged integration where we were able to show almost all the code, we have a code-base that’s a bit more involved this time and so we will just pick out the important parts for further explanation. For the full detail, you can of course dig into the source code.
Property Editor Configuration
Let’s start though with the property editor itself, looking at the code for V8. To create one of these using C#, a class inheriting from DataEditor is required, which is attributed with various settings, and has a method for the available configuration overridden.