Skip to main content
Solved

Updating SMS Consent (Node.js Server-side)


Forum|alt.badge.img+2

(solved, see reply below!)

Having some trouble updating a Profile to indicate that the user has consented to receiving SMS messages.  I’m following along this document:
https://help.klaviyo.com/hc/en-us/articles/360054803711-Guide-to-Collecting-SMS-Consent-via-API#include-phone-number-and-consent-status5

Looks pretty straightforward -- just make an HTTP POST with the signup details. But even after I submit that POST, when I go look in that users’ profile in the Klaviyo UI, I don’t see any SMS consent -- I only see email consent listed in the `Channels` area:

 

 

My HTTP POST looks like this. My list “S****k” is set to double-opt-in, if that matters.

POST https://a.klaviyo.com/api/v2/list/S****k/subscribe

{
    "api_key":"pk_f7************************eb",
    "profiles":[
        {
           "email": "jo**********+20@sp********.com",
           "$consent": ["sms"],
           "phone_number": "+12345678902",
           "sms_consent": true
       }
    ]
}

The response is a 200 OK with an empty array:

200 OK

[]

 

When I “Export Profile” the user through the Klaviyo UI, I can definitely see that the phone number I sent in was saved, and all of the SMS properties appear to be set too!

customer_properties.json

{
  "object": "person",
  "id": "01******************H6",
  "$address1": "",
  "$address2": "",
  "$city": "",
  "$country": "United States",
  "$latitude": "",
  "$longitude": "",
  "$region": "",
  "$zip": "",
  "$email": "jo******************+20@sp*******.com",
  "$first_name": "",
  "$last_name": "",
  "$organization": "",
  "$title": "",
  "$phone_number": "+12345678902",
  "$timezone": "",
  "$id": "",
  "$consent_timestamp": "2021-05-18T18:35:02.161Z",
  "$source": -9,
  "$consent": [
    "sms"
  ],
  "sms_consent": true,
  "email": "jo******************+20@sp*******.com",
  "first_name": "",
  "last_name": "",
  "created": "2021-05-18 17:47:11",
  "updated": "2021-05-18 18:35:02"
}

 

What I expected to see in the Klaviyo UI was something like the below. There is a Consent Status listed for *both* the email and phone number. This sample user was updated via the CSV import from a list, not using the API.
 

 

What am I doing wrong?

Best answer by spacedeveloper

Ended up being a data+configuration issue!

The list I was subscribing to had Double Opt-In configured. And the phone number I was using to test the API out was just a junk throw-away number `1234567890`. So after subscribing the user, Klaviyo was sending out the double opt-in to that 1234567890, which obviously was never accepted & replied to.

I used a real phone number and went through the double opt-in process. I can now see the SMS consent added on the user profile.

Thanks, Klaviyo support for walking me through this!


 

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

5 replies

Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 1 reply
  • Answer
  • May 18, 2021

Ended up being a data+configuration issue!

The list I was subscribing to had Double Opt-In configured. And the phone number I was using to test the API out was just a junk throw-away number `1234567890`. So after subscribing the user, Klaviyo was sending out the double opt-in to that 1234567890, which obviously was never accepted & replied to.

I used a real phone number and went through the double opt-in process. I can now see the SMS consent added on the user profile.

Thanks, Klaviyo support for walking me through this!


 


David To
Klaviyo Employee
Forum|alt.badge.img+60
  • Klaviyo Employee
  • 2456 replies
  • May 18, 2021

Hello @spacedeveloper,

Thanks for following up with a resolution! 

I’m sure this insight will help to serve other Community members looking to leverage API to collect SMS consent!

Thanks again for being a part of our Community!

-David


Forum|alt.badge.img+2
  • Contributor III
  • 5 replies
  • February 17, 2022

Hi, we have the exact same issue: sms number not getting into channels:

$consent and sms consent is sent, numbers can receive sms and the list is NOT double opt in.

 

USA numbers are getting into channels but Australian don't.

 

Why?

 

Thanks is advance


David To
Klaviyo Employee
Forum|alt.badge.img+60
  • Klaviyo Employee
  • 2456 replies
  • February 17, 2022

Hey @nandorhargita,

Since it sounds like you were able to pass SMS consent for US numbers, this indicates that your calls are being made correctly. 

However, since it seems to only be effecting Australian numbers, this leads me to suspect that you may not have fully setup SMS for international sending within your account. Can you confirm if you’ve set up your alphanumeric sending number prior to making these calls for Australian numbers? 

As detailed in the Set Up Your Alphanumeric Sender ID subsection of our Getting Started with SMS and MMS for the First Time Help Center article:

If you plan to send in the UK or Australia, edit your alphanumeric sender ID to indicate your brand. Setting this up is key, as you will not be able to collect SMS consent from people in these countries until you have an active alphanumeric sender ID.

David


Forum|alt.badge.img+2
  • Contributor III
  • 5 replies
  • February 18, 2022

@David To this is a great advice, thank you, first tests show quite promising results!

However, an advice to you guys: I was testing for days and reading documentation over and over again, especially the setting up SMS via API.

Such an important setting like mandatory alphanumeric ID for Australia could be mentioned in more docu sites. Would have spared me quite a few hours :)

Thank you for your quick help!