Skip to main content
Solved

Set a custom property using node sdk

  • June 19, 2024
  • 2 replies
  • 56 views

Forum|alt.badge.img+2

custom property not being set using node.js SDK

 

payload like so: 
 

const subscribe: SubscriptionCreateJobCreateQuery = {
data: {
type: ProfileSubscriptionBulkCreateJobEnum.ProfileSubscriptionBulkCreateJob,
attributes: {
profiles: {
data: [
{
type: ProfileEnum.Profile,
attributes: {
email: toEmail,
subscriptions: {
email: {
marketing: {
consent: "SUBSCRIBED",
},
},
},
properties: {
submissionId,
},
},
},
],
},
},
relationships: {
list: { data: { type: "list", id: listId } },
},
},
};
const response = await profilesApi.subscribeProfiles(subscribe);

 

 

properties: { submissionId }

 

This value is not present in the UI when I submit the profile - I can the contact has been created in the UI, but the proeprty is not being set. 

Am I doing something wrong? 

Thanks. 

Best answer by KeviSunshine

Hi @hmenen,

As far as I know, the new bulk-subscribe endpoint doesn’t supporting adding/updating profile properties anymore. There is no field `properties` in the documentation: https://developers.klaviyo.com/en/reference/subscribe_profiles.

We’ve had to change our integrations to call an insert/update/upsert function for the profile before subscribing the profile (or vice versa since you can create a profile via the bulk subscribe endpoint).

 

Best,

Kevin.

2 replies

Forum|alt.badge.img+32
  • Partner
  • 253 replies
  • June 20, 2024

Hello @hmenen you have to pass the customer property  as a key value pair.

 

Change 

submission Id

To

submissionId: "ID_VALUE"


KeviSunshine
Expert Problem Solver III
Forum|alt.badge.img+8
  • Expert Problem Solver III
  • 160 replies
  • Answer
  • June 20, 2024

Hi @hmenen,

As far as I know, the new bulk-subscribe endpoint doesn’t supporting adding/updating profile properties anymore. There is no field `properties` in the documentation: https://developers.klaviyo.com/en/reference/subscribe_profiles.

We’ve had to change our integrations to call an insert/update/upsert function for the profile before subscribing the profile (or vice versa since you can create a profile via the bulk subscribe endpoint).

 

Best,

Kevin.