Skip to main content
Solved

Back in stock client-side API custom fields

  • September 19, 2024
  • 1 reply
  • 40 views

Forum|alt.badge.img

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': ['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'."
}

 

Best answer by MCBCarsten

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.

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

1 reply

Forum|alt.badge.img
  • Author
  • Contributor I
  • 1 reply
  • Answer
  • September 19, 2024

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.