Skip to main content

Hi fellow devs

I’m setting up a custom Back-In-Stock feature using the client-side request https://a.klaviyo.com/client/back-in-stock-subscriptions/?company_id=${this.json.klaviyo_public_api_key} using these docs: https://developers.klaviyo.com/en/docs/how_to_set_up_custom_back_in_stock#client-side-request.

It works great, however, I also need to be able to send custom fields to the customer profile. Just like in the newsletter forms we can send data like 

$fields: Store
Store: Teststore
g: {ListID}
email: storetest@mail.com

or whatever other custom field we need. 

I’ve tried multiple ways of structure, but always run into errors as soon as i vary from this:

    const payload = {
'data': {
'type': 'back-in-stock-subscription',
'attributes': {
'profile': {
'data': {
'type': 'profile',
'attributes': {
'email': email,
}
}
},
'channels': a'EMAIL'],
},
'relationships': {
'variant': {
'data': {
'type': 'catalog-variant',
'id': `$shopify:::$default:::${variantId}`
}
}
}
}
};

Klaviyo email support was no luck. So I’m trying here 🤞

EDIT:

Example response when trying to add custom fields:
 

{
code: "invalid",
status: 400,
detail: "'tags' is not a valid field for the resource 'profile'."
}

 

Found a solution using Legacy Identify API to update the custom properties post-BIS-subscription. Not ideal, but works. 

Would still like to know if it is possible through the back-in-stock-subscription endpoint.


Reply