Goal: Read in order information from a webhook using JSON. Create a custom event in Klaviyo with that order information.
Problem 1: Klaviyo doesn’t natively accept line items.
Problem 2: The line items coming in on JSON are not being treated as line items in Zapier...I don’t think.
I’ve been following this guide, but there is an amazing amount of gaps, assumptions, simplistic examples, and just overall, not very thorough or helpful.
Here is some sample data from the guide above. Notice how it is structured.
Here is some sample data from my actual webhook:
Although the text is different, the format is the same.
The problem I’m running into is that each order can have any number of “orderRows.” Maybe 1, maybe 10. When trying to access this data later on in the next step, I would expect to find an array of values stored in “productName.”
However, that is not the case. Instead, each “productName” is being stored as a separate entry. Here’s what I mean:
What I would have expected is something like this, with one row containing all the values:
Now, even if or when I can get that part figured out, I still have the challenge of being able to read that into Klaviyo. I understand it might still take multiple steps and formatting, but again, the guide above is extremely lacking.
What needs to happen is that there is 1 event. That 1 event will have an order total price (also included in JSON). But then each order will have multiple line items for different products, prices, and quantities.
This is what an event looks like when it is read in by a native Magento2 integration:
I don’t particularly care about what my event looks like as long as all the correct information is there and I can access it for segmenting and triggering automations. And yes, all that information is available in the JSON Payload, I just have to get the line item feature working in order to bring it in.
By following the guide and using the line-item to text formatter, I still wasn’t able to read in array data as separate lines in Klaviyo. Here is the formatter input:
Here is the formatter output:
But when I send the “text” items into Klaviyo, it shows up like this:
So, where the hell do I start?
Thank you!