Hi Klaviyo Community Have a Good Day
I’m working on a shopify project and want to collect user email and message in Klaviyo. I want to use my own popup form(email, message fields and a submit button) and send AJAX request to Klaviyo. Please help me what’s the endpoint where AJAX request send to like https://manage.kmail-lists.com/ajax/subscriptions/subscribe but it’s provide information whether the user is subscribed to a specific email.
Below is my code:
requestSwatchForm.addEventListener('submit', function(e) {
e.preventDefault();
var settings = {
"async": true,
"crossDomain": true,
"url": "https://manage.kmail-lists.com/ajax/subscriptions/subscribe",
"method": "POST",
"headers": {
"content-type": "application/x-www-form-urlencoded",
"cache-control": "no-cache"
},
"data": {
"g": "S2RrTD", // replace LIST_ID with id of list to be subscribed
"email": "abidarif982@gmail.com",
// pass in additional fields, each additional field
// must be included in the $fields string separated by commas
"$fields": "$message, $first_name, $last_name",
"$message": "Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime mollitia, molestiae quas vel sint commodi repudiandae consequuntur voluptatum laborum numquam blanditiis",
"$first_name": "Abid",
"$last_name": "Arif"
}
};
$.ajax(settings).done(function(response) {
console.log(response);
})
});