Skip to main content

I have an event flow that creates a custom property for the user called “latestPoem” and sets it with a generic value. Now that I have this custom property in the users profile I would like to update the value for it using a custom variable that contains a unique short poem related to the user. 

From my understanding this should be possible using the identify API but I am getting the result 0 when I try to do this:

'data', `{"token": "${token}","properties": {"$email":"${email}", "latestPoem": "${poem}"}}`)

When I remove the variable latestPoem I get a result 1 meaning success:

'data', `{"token": "${token}","properties": {"$email":"${email}"}}`)

Does the identify API not support the updating of custom profile properties? From my understanding it does. Is there another way to do this? Am I formatting my request incorrectly? Do I need to use a different API? 

Hi @PoemAI,

I’ve just attempted your call with success. I’ve added a property called “latestPoem” to a customer profile. The only place I could see a difference is if the value “${poem}” isn’t escaped properly or something.

Try hard coding that poem value as a test. You might find the issue there.


Hi there,
I’d recommend using this endpoint to update the profile property: https://developers.klaviyo.com/en/reference/update_profile (server-side)
or
this endpoint : https://developers.klaviyo.com/en/reference/create_client_profile for publicly-browseable, client-side environments only.

Here is how to update a property using the flow in the UI:
https://help.klaviyo.com/hc/en-us/articles/360001768432


Hi @PoemAI,

I’ve just attempted your call with success. I’ve added a property called “latestPoem” to a customer profile. The only place I could see a difference is if the value “${poem}” isn’t escaped properly or something.

Try hard coding that poem value as a test. You might find the issue there.

@jjensen_ksp good point!

 

So I’m hardcoding the value “${poem} as “To be or not to be” and receiving a 1 but it isn’t actually updating on the users profile. 


So I’ve figured out the issue! My ${poem} variable unfortunately has newline characters which breaks the url encoding.

Unfortunately this is a bit of a tricky issue now as I’ll have to figure out how to format the users poem nicely in an email campaign but at least there is progress…


@PoemAI can you replace your newline chars with %0A?


@PoemAI can you replace your newline chars with %0A?

I tried this… sadly its still not formatting %0A even with the pre tag. At this point I’m probably going to have to look into somehow storing the poem value as a list.


Reply