I am attempting to send a back in stock subscription using the legacy API endpoint. I’m using the node fetch API and sending a POST request with the following code;
const formData = new URLSearchParams();
formData.append('a', KLAVIYO_PUBLIC_API_KEY);
formData.append('email', email);
formData.append('variant', variantId);
formData.append('platform', 'api');
const klaviyoRes = await fetch(`${KLAVIYO_BIS_API_URL}/subscribe`, {
method: 'POST',
headers: {
'content-type': 'application/x-www-form-urlencoded',
},
body: formData,
});
I keep getting a response back that this endpoint does not accept a GET request from Klaviyo. Anyone have a node implementation that works here or uses one of their SDK’s for this?