Solved

How to add array in custom properties using JSON api request

  • 6 April 2021
  • 3 replies
  • 1007 views

Badge +2

Hi,
      How to add array in custom properties using JSON api request ? i am using this

$b='{
  "token" : "token",
  "properties" : {
    "$email" : "'.$email.'",
    "AutoShipDate" : "'.$adate.'",
    "Autoship": true
  }

but I want add multiple dates in AutoShipDate property ?

icon

Best answer by elisegaines 6 April 2021, 21:11

View original

3 replies

Userlevel 5
Badge +25

Hey @Aamir! It sounds like the JSON array format would work best here. That would look something like this: 
   "AutoShipDate" : ["date1","date2","date3"], 

Badge +2

Thank you for reply. i apply this. it get saved. but  . if i create Flow that runs on specific autoshipDate only, then it's not shown as trigger selection because then AutoShipDate type turn into List, not Date. the requirements are. one customer may have many Autoship Orders schedule in future dates. Flow need to send Email on each Date which added in Cutom Property "AutoShipDate" : ["date1","date2","date3"], any idea?
     

Userlevel 5
Badge +25

Oh, I see! Thanks for clarifying. 

In order to trigger a flow, each date would need to be a separate property (and you’d need to create a separate flow for each date). There’s not a way to include multiple dates in a single property and have the flow trigger for each one. 

However, I'd like to recommend an alternative option: sending “events” over the API (instead of profile properties), and then using an event-triggered flow. With that solution, you can send an Order Shipped event to Klaviyo every time an order ships, and that will trigger the flow. 

You can learn more about how to do this here: https://www.klaviyo.com/docs/http-api 

Reply