Hello Community,
I’m working on a workflow in Make.com where I need to fetch product data from my WooCommerce WordPress API and map it to a different data model before sending it to my custom API. I’ve attached an image of my current setup for reference. The challenge is transforming the WooCommerce properties into the structure required by my API.
Workflow Overview:
- Get Products from WooCommerce: I retrieve the product data using the WooCommerce REST API.
- Get PIM Auth Token: I authenticate with my custom API using basic auth to retrieve a token.
- Iterator: Each product from WooCommerce is processed individually.
- HTTP Request: I send the mapped data to my custom API.
The Mapping Challenge:
WooCommerce and my API use different property names and data types. For example:
- WooCommerce has a property called
isVisible
with a string value like"visible"
. - My custom API expects a property called
isActive
, which is a boolean.
Logic:isActive = isVisible === "visible" ? true : false
.
This mapping process needs to be applied to every product property. Here’s another example:
- WooCommerce:
regular_price
(string). - My API:
price
(float).
Logic:price = parseFloat(regular_price)
.
What I Need Help With:
- JSON Request Content: In the HTTP module, I need to construct the JSON request body for my API with all the mapped fields.
- Best Practices: Suggestions for efficiently mapping the data in Make.com to ensure accuracy and maintainability.
- Dynamic Mapping: If there’s a way to handle this dynamically (e.g., with reusable transformations), that would save a lot of time.
Example Mapping:
Here’s a sample transformation logic:
json
“isActive”: “{{isVisible}} == ‘visible’ ? true : false”,
“price”: “{{regular_price}} | number”,
“name”: “{{name}}”,
“sku”: “{{sku}}”,
“description”: “{{short_description}}”,
“stockQuantity”: “{{stock_quantity}} | number”,
“tags”: “{{tags}}”
Screenshot Reference:
The attached image shows my Make.com setup. As you can see, I’m at the point where I need to configure the JSON request content in the HTTP module.
Any guidance on the best way to approach this mapping in Make.com would be greatly appreciated!