Hi,
New user, currently integrating. I’m importing/maintaining customer profiles via API call - a PUT request to https://a.klaviyo.com/api//v1/person.
The payload is a standard array (this is PHP, btw, using curl, we have a custom ecommerce setup).
This works fine for built-in and custom properties as long as they are simple types, and also $consent seems to be fine just as an array too, ie:
$dataArr = array( 'api_key' => MY_PRIVATE_KEY, 'active' => 1, 'orphan' => 0, '$city' => $cust->cust_del_town, '$country' => $this->zone_countries_name_lookup[$cust->cust_del_country_id], '$phone_number' => $cust->cust_del_telephone, '$zip' => $cust->cust_del_postcode, '$last_name' => $cust->cust_del_last_name, '$first_name' => $cust->cust_del_first_name, 'last_name' => $cust->cust_del_last_name, 'first_name' => $cust->cust_del_first_name, '$title' => $cust->cust_del_title, 'country_iso2' => $this->zone_countries_code_lookup[$cust->cust_del_country_id], 'is_uk' => ($cust->cust_del_country_id == UK_COUNTRY_ID ? 1 : 0), 'is_row' => ($cust->cust_del_country_id == UK_COUNTRY_ID ? 0 : 1), 'is_ml' => 0, 'hs_cust_id' => $cust->cust_id, 'hs_contact_type' => 'cust_table', 'hs_subscribed_date' => $cust->cust_reg_datetime, 'hs_no_of_orders' => $noOfOrders, 'hs_order_total_gbp' => $cust_lifetime_order_total, 'hs_last_ordered_datetime' => $most_recent_purchase_date, 'hs_marked_as_fraud' => $cust->fraud, 'hs_product_tags_purchased' => $this->listify($product_tags_purchased, 'str'), 'hs_brands_purchased' => $this->listify($brands_purchased, 'str'), 'hs_date_of_last_return' => $date_of_last_return, 'hs_returned_product_ids' => $this->listify($returned_product_ids, 'num'), 'hs_last_shoe_size_bought' => $last_shoe_size_bought, 'hs_last_non_shoe_size_bought' => $last_non_shoe_size_bought, 'updated' => date("Y-m-d H:i:s"), '$consent' => array('email'));
...but hs_product_tags_purchased, hs_brands_purchased and hs_returned_product_ids don’t seem to be importing correctly as lists (the first 2 are lists of strings, the last one a list of integers.
I have tried sending them as native arrays, and also as json formatted strings (this is what $this->listify does, changes array(‘Herring’) into [“Herring”].
When I send as arrays, the value does not appear in the customer profile. When I try as a json formatted string ([“Herring”]) then the value appears in the customer profile as a string ‘[“Herring”]’ but cannot be searched using a ‘list contains’ query when creating a segment.
How do I import arrays as custom properties?
Many thanks,
Gareth