I’m trying to collect SMS consent on a legacy form submitting to https://manage.kmail-lists.com/ajax/subscriptions/subscribe
From the API documentation, I’ve tried to collect the consent with the following data objects:
$consent: n"sms"],
phone_number: customers_number
"sms_consent": true,
In the API documentation I see that it specifies "sms_consent": True with a capitalised True. But if I use that in this context the script is expecting a variable so I’ve used a lowercase true
But this doesn’t seem to work with the subscription ajax. If it possible to collect SMS consent this way?
Heres my full script for reference:
$.ajax({
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: klaviyo_list,
$fields: "$source, $consent, email, phone_number, sms_consent, $first_name, $last_name, Shopify Tags, Accepts Marketing",
$source: "Footer",
email: emailaddressVal,
$consent: /"sms"],
phone_number: $form.find('.k_id_phone').val(),
"sms_consent": true,
$first_name: $form.find('.k_id_fname').val(),
$last_name: $form.find('.k_id_lname').val(),
'Shopify Tags': custPreferences.toString(),
'Accepts Marketing': true
},
success: function(response){
//console.log(response)
$('#newsletter-popup .header').hide()
$form.html("<div class='email-success'><h3>SUCCESS.</h3>"+success_message+"<p><b>"+success_code+"</b></p></div>")
}
});