Can't seem to collect SMS consent with legacy form

  • 10 November 2022
  • 1 reply


I am having trouble collecting SMS consent with a legacy form using the API documentation for reference.


This previously posted question (Collect SMS consent with legacy form) highlights the same issues I am currently facing, though the provided answers does not seem to be the solution in this case:

  1. The phone number entered is a valid US number
  2. Double-opt-in is disabled for the list 
  3. The account does have SMS set up and enabled.


Here is the script for reference: 

let klaviyoSubscribeURL = "";

const data = {
g: "VXXXXS",
'$fields': '$source,$email,$consent_method,$consent_form_id,$consent_form_version,phone_number,sms_consent,$consent',
'$list_fields': '',
'$timezone_offset': Math.abs(new Date().getTimezoneOffset() / 60),
'$source': '$embed',
'$email': email,
'$consent_method': 'Klaviyo Form',
'$consent_form_id': formId,
'$consent_form_version': 524456,
'phone_number' : phone,
'$consent' : ['sms'],
'sms_consent': true

fetch(klaviyoSubscribeURL, {
"method": "POST",
"mode": "cors",
"credentials": "omit",
"headers": {
"access-control-allow-headers": "*",
"content-type": "application/x-www-form-urlencoded; charset=utf-8"
"referrer": location.href,
"referrerPolicy": "no-referrer-when-downgrade",
"body": Object.keys(data).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(data[key])}`).join('&')
.then(res => res.json(), (res) => {
// console.log(res);

return res.json();
.then(data => {
if (data.success) {


When I export the the profile data, it seems to be missing the sms_consent data object:

"object": "person",
"$address1": "",
"$address2": "",
"$city": "",
"$country": "",
"$latitude": "",
"$longitude": "",
"$region": "",
"$zip": "",
"$title": "",
"$email": "",
"$organization": "",
"$first_name": "",
"$last_name": "",
"$phone_number": "(310) XXX XXX6",
"$timezone": "",
"$id": "",
"$source": "$embed",
"$consent": [
"$consent_timestamp": "2022-11-10T00:20:14.517Z",
"Newsletter Signup": "2022-11-09",
"email": "",
"first_name": "",
"last_name": "",
"created": "2022-11-10 00:20:15",
"updated": "2022-11-10 00:20:44"


Is it still possible to collect SMS consent in this way?


Best answer by Brian Turcotte 10 November 2022, 23:04

View original

1 reply

Userlevel 6
Badge +29

Hi @Eskae and welcome to the Community!


I see that in the sample request you provided, you are making an AJAX request:



Per our documentation here, the “email” field is required in a POST request using AJAX. This means that the endpoint will only work to collect email, and you can just pass a phone number as a custom property if you wish.


The documentation that you referenced was definitely the correct resource, but it does call to make a POST request to the Subscribe endpoint:{LIST_ID}/subscribe


This topic was also discussed in this Community thread:


Therefore, I would suggest to adjust that call to mirror the sample in the documentation, and if all the other bullets are hit (SMS activated, valid number, etc.), it should work as intended.


I hope this helps, and thanks for using the Community!