Hi All,
Anyone has luck in creating profiles in Klaviyo using direct javascript api.
I found below link but not working for me when try to use that.
Thanks in advance.
Hi All,
Anyone has luck in creating profiles in Klaviyo using direct javascript api.
I found below link but not working for me when try to use that.
Thanks in advance.
Best answer by Chops
I’m not using Javascript but from the Klaviyo API revision 2022-10-17. I can successfully create a profile using the following payload:
payload = {
data: {
type: 'profile',
attributes: {
email: user.email,
phone_number: include_phone ? phone_number : nil,
first_name: user.first_name,
last_name: user.last_name
}
}
}
Note the include_phone is a boolean that allows me to include the phone if I think it’s legit. Klaviyo will error out on fake phone number so you really need to verify ahead, or retry without a phone number if the request fails.
This is a POST request to:
"https://a.klaviyo.com/api/profiles/"
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.