Hi again Community!
My objective is to take orders from my Shopify store, split each SKU in that order and match against additional row data in Google Sheets, and then aggregate that data back into a single bundle to pass to the HTTP module API back to my supplier.
Steps in my Flow:
- Shopify Webook to Watch Orders: Captures new orders.
- Iterator: Splits the array of line items.
- Google Sheets Search Rows: Matches each SKU from the order to the SKU in Google Sheets and retrieves additional data against that SKU.
- Array Aggregator: Aggregates the matched results into a single array.
- HTTP Request: Sends the aggregated data to the API.
Issues:
- After I aggregate the data back into a Bundle, I get a collection for each SKU in that order (see screenshot). This is good, because I want to send the order with all the skus as one API call.
- In the HTTP module, I have an array called
items
where each item has a basic structure ofSKU
andDetails
. - When I reference the aggregator for the SKU and the details, it only returns the first collection (i.e., the first SKU in the order).
- I then tried to use the
map
function with the raw value, to get all the SKUs and their details in the order (see screenshot). - However, the
map
function concatenates the values as strings instead of treating each SKU order as its own object.
Desired Output:
In my API, I want the basic structure of:
"items": [
{
"sku": "SKU 1",
"details": "SKU 1 Google Sheet Matching Details"
},
{
"sku": "SKU 2",
"details": "SKU 2 Google Sheets Matching Details"
}
]
Current Output:
What I am getting instead is:
"items": [
{
"sku": "SKU 1, SKU 2",
"details": "SKU 1 Google Details, SKU 2 Google Details"
}
]
Screenshots:
The Flow
The Aggregator turning multiple Bundles into one with a collection for each SKU
How I am using the map function to get to all the SKU (one in each collection from the Aggregator )
Example of the HTTP concatenating each collection into the same line instead of repeating it as an object (please note it while it looks like it printed the same SKU twice, they are actually different SKU, one from each collection, due to the row matching from Google Sheets).
Any error messages: No error messages, but incorrect concatenation of SKU values.
Additional Context:
- I have ensured that the Iterator splits items correctly.
- Verified that the Google Sheets Search Rows module uses dynamic SKU from the iterator.
- Ensured that the matching works, and the API receives data from both the Shopify module and the matched row.
Any advice on ensuring all SKUs are processed correctly and outputted as separate objects within the items
array?
Thank you!