Solved

Subscribe Profile and add custom properties using latest Klaviyo API

  • 29 September 2023
  • 12 replies
  • 496 views

Badge +1

Using this endpoint:

https://developers.klaviyo.com/en/reference/subscribe_profiles

 

Is it possible to subscribe a profile to a list and also add custom properties to that profile in one request? This was possible with the previous API version but now I’m not sure.

 

My request works without adding custom properties, but when I tried adding ‘newKey’ => ‘value’ to the Profile’s object and I got this error:

newKey' is not a valid field for the resource 'profile' 

 

Thank you

icon

Best answer by Brian Turcotte 19 October 2023, 21:31

View original

12 replies

Userlevel 7
Badge +36

Hi @acavdev!

I’m going to check on this with Engineering and I’ll update the thread ASAP!

Best,

Brian

Badge +1

Thank you!

Badge +1

Hi Brian,

 

Did the engineering team have any feedback on this one? Thank you!

Hey Brian, any update on this?

We’re moving to the new API and facing this same issue of not being able to set custom properties in the same request.

Userlevel 7
Badge +36

Hi @adil.naqvi!

My sincere apologies for the delay here! It’s true that you can no longer add custom properties to a profile using this endpoint, which is intended only to identify and subscribe the profile to a list. 

 

Instead, you would have to make two calls, one to subscribe and one to update the profile with the custom properties using the Update Profile endpoint.

 

Best,

Brian

 

Badge +1

Hi Brian,

 

Thank you. Is it possible after sending the first request to subscribe to get the Primary key/ID of the user as response from that request?

 

Thank you

Hi @adil.naqvi!

My sincere apologies for the delay here! It’s true that you can no longer add custom properties to a profile using this endpoint, which is intended only to identify and subscribe the profile to a list. 

 

Instead, you would have to make two calls, one to subscribe and one to update the profile with the custom properties using the Update Profile endpoint.

 

Best,

Brian

 

Has anyone been able to get this to work?  I have tried to add properties but they dont appear or update.  I have tried using the meta object but the values appear in [] brackets as if the value is an array element - seems like the API mis-interprets the json structure - even though I followed the documentation 

Badge +1

Is it possible after sending the Subscribe request , to then get the User ID of the user as response from that request?

In order to subscribe and then update I assume I would need to have the subscribed users ID

Thanks!

Badge +1

@ur.co.uk I have not been able to get this to work still. If anyone has figured it out , please let me know!

Can someone explain why this is so complex? I’m stuck using your identify endpoint because the new update documentaiton is terrible.

Badge +1

@Colton From what I figured out with some help from my team, the working order of API operations is:
 

Add to list

https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs/

 

Create/Update profile

https://a.klaviyo.com/api/profile-import/

I’m having issues with this as well.

Before, I could subscribe the user and update custom properties in one request.

Now, with the new API, I need to make 3 requests to do this.

1. Subscribe the user

2. Get profile id, since the subscribe endpoint does not send a response id (ridiculous)

3. Update profile

But here’s the problem... If I do this synchronously, the 2nd step (finding the profile id) doesn’t work because it can’t find the profile id yet since it’s probably just been created. It will work a few seconds later but I need this to happen immediately.

Lmk if there’s another way?

Reply