klaviyo / magento2-klaviyo

37 stars 51 forks source link

Fix customer custom properties KlaviyoV3Api.php #289

Closed JamesFX2 closed 1 month ago

JamesFX2 commented 4 months ago

Hey, you've formatted the properties incorrectly, in the profile object, in properties is a child of data / attributes - see https://jsonformatter.org/fa628e for reference which was taken from the API example on Klaviyo

Description

Fixes bug with sending custom data on a profile to Klaviyo events API

Manual Testing Steps

This is an event we sync to Klaviyo that updates a customer profile. This field is no longer updating the contact. I've checked the API documentation and I have found this bug.

 {"data":{"type":"event","attributes":{"properties":{"$value":null},"time":"2024-02-06T13:46:34","value":null,"metric":{"data":{"type":"metric","attributes":{"name":"Customer Sync","service":"magentotwo"}}},"profile":{"data":{"type":"profile","attributes":{"email":"bcedd554123b00cff993@redacted.com","first_name":"Leila","last_name":"Test"},"properties":{"$first_name":"Leila","$last_name":"Test","email":"bcedd554123b00cff993@redacted.com","$nhs_last_date":"2024-02-06","nhs_last_date":"2024-02-06"}}}}}}
JamesFX2 commented 4 months ago

@cykolln sorry, are you talking to me?

cykolln commented 4 months ago

@cykolln sorry, are you talking to me?

@JamesFX2 Yes, sorry!

JamesFX2 commented 4 months ago

Added requested changes @cykolln

jordanleslie commented 4 months ago

Added requested changes @cykolln

Once CI is passing i'll merge this in.

cykolln commented 1 month ago

@JamesFX2 Hey! Looks like precommit is failing for this PR - locally you can run pre-commit run --all-files to resolve. We can get this merged in as soon as CI is passing.