TABLE OF CONTENTS
- Introduction
- The Route
- Incoming Configuration
- Outgoing Configuration
- Entity Transformer
- Making The Connection: A Step-by-step Guide
- Data X
- Filtering Out Unnecessary Tasks When Products Don’t Change
- Data Y
- Closing Thoughts!
Introduction
CommerceTools is considered as one of the frontrunners in the eCommerce space when it comes to customizing business and customer experience. If you are looking to integrate your business with th6e CommerceTools platform, let Alumio sail the ship for you!
This guide will provide insights on how to integrate a sFTP environment (containing a product XML file) and a commercial environment with the help of Alumio. This is done by reading an XML file from sFTP and checking whether or not a product has changed. If the product has changed, a task will be created and if it has not, it will be filtered out.
The Route
To begin with, we will start off with a route- Products from XML to CommerceTools. It contains an Incoming configuration- Get Products From XML and an Outgoing configuration- CommerceTools- Create Product.
Incoming Configuration
The Incoming configuration is responsible for retrieving the products from the sFTP environment. Upon clicking View configuration just beneath the Incoming configuration, you can check the nitty gritties of it. For instance, there will be a Subscriber that includes a Filesystem: file subscriber system that connects to the generic Alumio sFTP environment and is looking for a file (in Patterns) called products.xml.
Outgoing Configuration
Similarly, there is an outgoing configuration for the route. If you click on the View configuration just beneath the Outgoing configuration, you will be redirected to the configurations set up page.
Here, you will see that it has a Publisher that utilizes the commerce sale publisher Commercetools, which connects to a specific Commercetools HTTP Client (environment) called. The environment is further connected to the Module called Products.
Entity Transformer
Moving on, you will also come across an Entity Transformer within the Outgoing Configuration called Map Product. You click on the View configuration just beneath it to check its functioning. What it does is that it maps the incoming product data to a CommerceTools product.
Making The Connection: A Step-by-step Guide
To have a better understanding, you can check the CommerceTools (open it in another tab). If you click on Products (left-hand panel), you will see that there are no products present right now.
If you open the sFTP environment of Alumio, you won’t find anything there as well.
What you can do is that you can create a new XML file in the editor.
Step 1.1: Create an XML file having three products (for example). Let’s call it data X.
Data X
<products>
<product>
<sku>alumio-t-shirt</sku>
<name>Alumio T-shirt</name>
<publish>false</publish>
</product>
<product>
<sku>alumio-hat</sku>
<name>Alumio Hat</name>
<publish>false</publish>
</product>
<product>
<sku>alumio-hoodie</sku>
<name>Alumio Hoodie</name>
<publish>true</publish>
</product>
</products>
So, in the above example of data X, we are considering three products namely Alumio T-shirt, Alumio Hat, and Alumio Hoodie respectively. So, each of these products has a name and a status that indicates whether it should or should not be published.
Step 1.2: Now, upload this file to the sFTP environment and then go back to Alumio.
Step 1.3: Go to the Incoming Configurations of the Route: Get Products From XML, and click on Run Incoming button at the top-right corner.
As you run the Incoming configuration, it will connect to the sFTP environment and look for a file called products.xml.
Step 1.4: A “Subscriber has been consumed” pop-up box will appear. Hit on Click to view more information just beneath it.
Step 1.5: Click on Logs. You can see that Alumio has created tasks (3). To verify this, you can go to the Dashboard (left-hand panel of Alumio). It will show that 3 New tasks have been created.
Step 1.6: Go to Dashboard>Tasks and here you will see that all the three tasks belong to the single route called Products from XML to CommerceTools. The entity identifiers will show alumio-hoodie, alumio-hat, and alumio-t-shirt.
Step 1.7: Open any one of the tasks. For example, let’s say you open the task with the Identifier: alumio-hat.
Step 1.8: Click on Entity Data at the top to view the corresponding data for the task. In this case, what you will see is:
{
"sku": "alumio-hat",
"name": "Alumio Hat",
"publish": "false"
}
JavaScript
This is the data retrieved from XML.
As soon as you execute the Route or export the data from Alumio to CommerceTools, the data will get mapped to a format that is compatible with CommerceTools. Eventually, the products will get created on the CommerceTools.
Step 2.1: Go back to Routes (Products from XML to CommerceTools) and click on Run Route (top-right corner). A “Publish has been exported” pop-up box will appear.
Step 2.2: Revert back to the task (step 1.7). Click on Overview and refresh it.
Step 2.3: Now, you will see that the Status is showing FINISHED (in green).
Step 2.4: Revisit the CommerceTools merchant center and refresh it. Now, three products will appear (Alumio Hoodie, Alumio T-Shirt, and Alumio Hat), which were created by the execution of the Route.
If you look at the status, you will see that the Status for each of them has also been mapped successfully. Alumio Hoodie has been Published (refer to Data X) while the Alumio T-shirt and Alumio Hat remain Unpublished.
Filtering Out Unnecessary Tasks When Products Don’t Change
In scenarios where Alumio reads the same XML file and the products haven’t changed, you can omit creating tasks because they become unnecessary. To do that, you can create a Filter within the Route.
Step 3.1: Click on Add entity transformer and select Filter previously stored entities from the drop-down menu.
Step 3.2: Next, you have to specify the Storage which will act as a comparison mechanism. It must contain a snapshot of all the imported products.
Thus, the next time Alumio reads an XML file, the transformer will compare the snapshot against the file. If everything remains identical, no tasks will be created. However, if any of the products is different, a task will be created for that specific one.
Step 3.3: Click on View configuration beneath the Storage to inspect it.
Step 3.4: Click on Entities. You will see that it contains three entities (alumio-hoodie, alumio-t-shirt, and alumio-Hat). You can configure the Identifier as per requirement. For example, the Identifier of each entity can be mapped to the sku of the product.
You can open any one of the Identifiers to view the data belonging to the specific product.
Step 3.5: Go back to the Route and open the Incoming Configuration once again by clicking on View configuration.
Step 3.6: Hit the Run Incoming button at the top-right corner and once again the “Subscriber has been consumed” pop-up box will appear. Hit on Click to view more information below it.
Step 3.7: Click on Logs. Now, you can see that the data is being filtered, thank you to the entity transformer you have implemented. There are 3 entities that will be filtered and no tasks will be created because every product is already identical to the storage.
Step 3.8: You can go back to the Alumio Dashboard again. There will be no New tasks reflected there as well.
Step 3.9: Click On the Tasks (left-hand panel of Alumio) and click on Routes (top-left corner). Search for Products from XML to CommerceTools and select it. Then, click on Apply.
Step 3.10: Here, you can see that there remains only the 3 tasks that were created in the beginning (step 1.5) and no new tasks have been added.
To ensure that the entity transformer - Filter previously stored entities is functioning smoothly, you can make some changes to data X. Let’s call this data Y.
Data Y
<products>
<product>
<sku>alumio-t-shirt</sku>
<name>Alumio T-shirt</name>
<publish>false</publish>
</product>
<product>
<sku>alumio-hat</sku>
<name>Alumio Hat 123</name>
<publish>false</publish>
</product>
<product>
<sku>alumio-hoodie</sku>
<name>Alumio Hoodie</name>
<publish>true</publish>
</product>
<product>
<sku>alumio-trousers</sku>
<name>Alumio Trousers</name>
<publish>true</publish>
</product>
</products>
Here, you can change the name of the second product from Alumio Hat to Alumio Hat 123 for example.
Also, you can add a new product called Alumio Trousers.
Step 3.11: Add data Y (new XML file) to the sFTP environment again (you might have to override the data).
Step 3.12: Repeat Step 3.5 and Step 3.6. Now, you can expect two new tasks to be created here- one for the changed product and one for the new one.
Step 3.13: Click on Logs and this time you will see that there are two new tasks which have been created. If you revisit the Dashboard, you will see that 2 New tasks are being reflected there as well.
Click on the New Tasks and the two new tasks will be reelected here.
If you check the Entity Identifier, you shall see that two tasks have been created for alumio-hat and alumio-trousers (which reflects the change we made in step 3.10).
If you click on the task for alumio-hat and check the Entity Data, it will reflect the changes.
{
“sku” : “alumio-hat”
“name” : “Alumio Hat 123”
“Publish” : “false”
}
Similarly, If you click on the task for alumio-trousers and check the Entity Data, you can see that the data has been retrieved for the new product.
{
“sku” : “alumio-trousers”
“name” : “Alumio Trousers”
“Publish” : “true”
}
Closing Thoughts!
When it comes to providing the best iPaaS solution to help businesses achieve smooth system-to-system integrations, Alumio certainly beats the competition by quite a margin. Being a user-friendly platform, it allows even the non-technical people to use it for a wide range of integrations. Let’s hope that this article has provided you a deep understanding of how to transfer products from XML/sFTP to Alumio. Stay tuned with us to learn more in some other article!