Skip to main content
Solved

How to filter object and array properties in the flow


Forum|alt.badge.img

hello. We are working on integrating klaviyo with an e-commerce system developed by our team.
We are sending API requests to klaviyo when an order is placed on our server.

I have a question.

[Q: How to filter object and array properties in the flow]

 

POST /api/events

{
  "data": {
    "type": "event",
    "attributes": {
      "properties": {
        "OrderId": "3",
        "Categories": [
          "study",
          "gift"
        ],
        "ItemNames": [
          "abc"
        ],
        "DiscountCode": null,
        "DiscountValue": null,
        "Brands": [
          "abc market"
        ],
        "Items": [
          {
            "ProductID": "1123123",
            "SKU": null,
            "ProductName": "abc",
            "Quantity": 1,
            "ItemPrice": 999,
            "RowTotal": 999,
            "ProductURL": "url",
            "ImageURL": "url",
            "Categories": [
              "study",
              "gift"
            ],
            "Brand": "fgs"
          }
        ],
        "ShippingAddress": {
          "Address1": "123-123",
          "Address2": "hello",
          "locality": "zzz",
          "administrativeArea": "seoul",
          "buildingName": "abc apt",
          "postalCode": "01849"
        }
      },
      "time": "2025-02-27T02:54:35.094075Z",
      "value": 127,
      "value_currency": "KRW",
      "unique_id": "3",
      "metric": {
        "data": {
          "type": "metric",
          "attributes": {
            "name": "Placed Order"
          }
        }
      },
      "profile": {
        "data": {
          "type": "profile",
          "attributes": {
            "email": "abc@gmail.com"
          }
        }
      }
    }
  }
}


We are trying to add an event filter in our flow.
We want to use Items and ShippingAddress, but we can't choose between them.

For example, I want to filter through ShippingAddress.postalCode or Items[].ItemPrice.
How can I filter on object and array properties?

Attach an image that you can't select Items from in the Trigger Filter.

 

Best answer by Byrne C

Hey ​@shawn.kim,

It looks like postal code and item price are buried too deep in the event data for you to use them in the flow filters. Flow filters can only use top-level event properties and their values, but once event properties have sub-properties themselves, those can’t be used in filters, unfortunately. 

For example, you can use ItemNames and Categories, since they’re top level properties, but not the postalCode, as it’s buried under another property. See below screenshot for example.

 

I’d recommend restructuring your event data, so the value of the order, the postal code, and other data you want to use in filters are top-level properties. Let me know if this makes sense, or if I can answer any additional questions.

-Byrne

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

Byrne C
Community Manager
Forum|alt.badge.img+14
  • Community Manager
  • 116 replies
  • Answer
  • March 6, 2025

Hey ​@shawn.kim,

It looks like postal code and item price are buried too deep in the event data for you to use them in the flow filters. Flow filters can only use top-level event properties and their values, but once event properties have sub-properties themselves, those can’t be used in filters, unfortunately. 

For example, you can use ItemNames and Categories, since they’re top level properties, but not the postalCode, as it’s buried under another property. See below screenshot for example.

 

I’d recommend restructuring your event data, so the value of the order, the postal code, and other data you want to use in filters are top-level properties. Let me know if this makes sense, or if I can answer any additional questions.

-Byrne


Forum|alt.badge.img
  • Author
  • Contributor I
  • 1 reply
  • March 11, 2025

@Byrne C 

Thank you Byrne
Your answer was very helpful to me


Reply