Skip to main content
Solved

How to add array in custom properties using JSON api request


Forum|alt.badge.img+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 ?

Best answer by elisegaines

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

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

3 replies

Forum|alt.badge.img+25
  • Customer Ed.
  • 86 replies
  • Answer
  • April 6, 2021

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


Forum|alt.badge.img+2
  • Author
  • New Member
  • 1 reply
  • April 6, 2021

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?
     


Forum|alt.badge.img+25
  • Customer Ed.
  • 86 replies
  • April 6, 2021

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