Skip to main content
Solved

Cannot add SMS consent via API


Forum|alt.badge.img+2

Hi! I’m trying to set up an API call that would subscribe user and create consents for both e-mail and SMS. My JSON looks like this:

{
    "profiles": [
        {
            "email": "m***@z******s.**",
            "phone_number": "+38631******",
            "sms_consent": true,
            "$consent": ["sms"]
        }
    ]
}

and API url is structured like this:

{{URL}}/list/{{LIST_ID}}/subscribe

I tried both Single and Double opt-in and it’s not working. Both e-mail and phone number are saved to profile, but only e-mail consent is displayed.

 I think I tried everything, but it’s still not working. Does anyone have an idea what I’m doing wrong?

Thank you!

Best answer by alex.hong

Hi there @mihamajetic,

Welcome to the Community and thank you for sharing your findings with us!

Since it looks like you are using an international calling code 386, which indicates it may be a Slovenian number, that is why you are currently experiencing the issue you are running into. At this time, Klaviyo SMS is not available everywhere. Currently, you can only collect SMS consent and send text messages in: 

  • *United States
  • Canada
  • UK
  • Australia

*The United States only includes the 50 US states and not Puerto Rico or other territories.

More info regarding this can be found in the related help center article!

Have a good day!

Alex

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

6 replies

Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 2 replies
  • January 4, 2022

It’s very likely that sms consent is not displayed in Klaviyo, because SMS are currently not available in EU. :disappointed_relieved:


alex.hong
Forum|alt.badge.img+58
  • Klaviyo Alum
  • 1552 replies
  • Answer
  • January 4, 2022

Hi there @mihamajetic,

Welcome to the Community and thank you for sharing your findings with us!

Since it looks like you are using an international calling code 386, which indicates it may be a Slovenian number, that is why you are currently experiencing the issue you are running into. At this time, Klaviyo SMS is not available everywhere. Currently, you can only collect SMS consent and send text messages in: 

  • *United States
  • Canada
  • UK
  • Australia

*The United States only includes the 50 US states and not Puerto Rico or other territories.

More info regarding this can be found in the related help center article!

Have a good day!

Alex


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

Hi, I also have the exact same problem (consent is not showing up properly in the profile) and the “consented to receive sms” event is not triggered, and I cannot build an automation on top of it.

I’ve tried hungarian, USA and australian numbers. Same API call, same non-Klaviyo popup, different - real - mobile numbers.

List is single opt-in!

  • Hungarian numbers are not getting consent. Because SMS is not available? OK, fine...
  • USA numbers are getting consent. Great!
  • Australian numbers not getting consent. Why?

Can you help please?


alex.hong
Forum|alt.badge.img+58
  • Klaviyo Alum
  • 1552 replies
  • February 18, 2022

Hi there @nandorhargita,

I saw you received an answer on:

Hope others can find the solution there as well.

Thank you!
Alex


Forum|alt.badge.img+1
  • Contributor I
  • 1 reply
  • March 14, 2022

Check for Prior Consent

The get-members List API endpoint can be leveraged to confirm that a contact number has or has not already consented to receiving SMS. To do so, make a POST request to https://a.klaviyo.com/api/v2/list/LIST_ID/get-members?api_key=API_KEY and include the phone numbers you wish to check for SMS consent in your payload. The example below uses Python. This method can also be used to check for email consent. 

If the phone number passed to the endpoint is not returned in the response, the number has not consented to receive SMS communications from you.

 

import requests

url = "https://a.klaviyo.com/api/v2/list/LIST_ID/get-members?api_key=API_KEY"

payload = {
    "phone_numbers": ["+13239169023", "+12028837032"]
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)


Forum|alt.badge.img+6
  • Problem Solver III
  • 38 replies
  • March 18, 2022

SMS subscription is handled by list API not profile API.  You need to submit $consent AND list API endpoint.