Skip to main content
Solved

Set a custom property using node sdk


Forum|alt.badge.img

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.

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

Forum|alt.badge.img+31
  • Partner
  • 252 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.