I want to do this so my webapp can decode the single query param and then run `JSON.parse()` on it to get all of the variables within.
Has anyone tried something similar? I’m running into a number of issues with creating stringified JSON objects with profile properties and b64 encoding them.
I’m also running into issues with creating profile properties that include variables in them...
Does anyone have any suggestions?
Thank you!
Kevin.
Best answer by JeffV.klaviyo
To close the loop here, we resolved part 1 of @KeviSunshine’s original question with the flow webhook action. The next step was to give Kevin the ability to base64 encode the following text:
"phone: <customer_phone_number>"
This was a bit tricky as we needed to take a string (“phone: “) and combine it with a dynamic variable (customer_phone_number), and then 64 encode the entire thing. Since our email templates use Django syntax, we needed to do the following:
Essentially, we need to save the string “phone: “ as one variable and then the customer’s phone number ( {{person.phone_number}} ) as another variable. We then used the django |add filter to concatenate/combine the two strings, and the |base64_encode django filter to encode everything.
Thank you for your patience @KeviSunshine and let us know if there is anything unexpected occurring with this solution.
Seems like you’ve been in contact with our awesome Support colleagues and getting down to the nitty gritty details of your question! Would love if you could follow up with the solution that’s been discussed to further help other Community members who may be running into the same question in the future!
For everyone who’s interested, we haven’t gotten to the crux of the issue yet but I did learn something very cool from one of Klaviyo’s awesome support specialists, Jeff.
If you want to set a profile property that consists of another profile property, you can use the Call Webhook step and call Klaviyo’s own Identify API. How cool is that! Here is how Jeff explained it…
Setting a property on a profile that consists of other properties You are correct that our "Update Profile Property" Flow action doesn't take in variables. Instead you should use our Webhook Actions so make an API Request to the our Identify API to update a profile property (https://developers.klaviyo.com/en/reference/track-post)
Here are some articles that discuss webhook flow actions:
$email is the profile that you want to assign the property to, then you can add any custom properties below that. You can refer to the API documentation here to learn about Identify API formatting: https://developers.klaviyo.com/en/reference/identify-post
To close the loop here, we resolved part 1 of @KeviSunshine’s original question with the flow webhook action. The next step was to give Kevin the ability to base64 encode the following text:
"phone: <customer_phone_number>"
This was a bit tricky as we needed to take a string (“phone: “) and combine it with a dynamic variable (customer_phone_number), and then 64 encode the entire thing. Since our email templates use Django syntax, we needed to do the following:
Essentially, we need to save the string “phone: “ as one variable and then the customer’s phone number ( {{person.phone_number}} ) as another variable. We then used the django |add filter to concatenate/combine the two strings, and the |base64_encode django filter to encode everything.
Thank you for your patience @KeviSunshine and let us know if there is anything unexpected occurring with this solution.