Solved

Looking up sms consent details with api

  • 4 January 2021
  • 5 replies
  • 82 views

Badge

Hi, does anyone know if it’s possible for me to lookup whether a user has consented to sms or not with the api using just the email address?

 

Thanks

icon

Best answer by k.mcevoy 4 January 2021, 20:50

Hi there, 

Thanks for being a member of the Community!

 

You should be able to retrieve a profile’s SMS consent using this endpoint: 

GET https://a.klaviyo.com/api/v1/person/{{ PERSON_ID }}

As outlined in this documentation.  The endpoint requires the person_id and if the retrieved payload includes “sms_consent”: True they have opted into SMS. More information on that here

 

Kelsey

View original

5 replies

Userlevel 4
Badge +3

Hi there, 

Thanks for being a member of the Community!

 

You should be able to retrieve a profile’s SMS consent using this endpoint: 

GET https://a.klaviyo.com/api/v1/person/{{ PERSON_ID }}

As outlined in this documentation.  The endpoint requires the person_id and if the retrieved payload includes “sms_consent”: True they have opted into SMS. More information on that here

 

Kelsey

Badge

Thanks for the reply. The issue I’m having is that in our db we don’t have the person_id stored, just information from shopify (customer info, email etc). Is there a way to do this with the email address instead of the id? If not is there a way to retreive the person_id via api using the email address to lookup?

 

Thanks

Userlevel 4
Badge +3

Got it! 

 

If you just have email address you should be able to make the following request: 

curl -X GET \  https://a.klaviyo.com/api/v2/people/search \  -H 'api-key: 'YOUR_PRIVATE_KEY' \  -d '{"email":"EMAIL_ADDRESS"}'

 

Just as a reminder we have an API limit of 3 calls/second. 

 

Kelsey 

Badge

Hi, thanks. The lookup works great. However once I get the person_id on the one I’m testing when I look it up with GET https://a.klaviyo.com/api/v1/person/{{ PERSON_ID }} 

 

I don’t see “sms_consent”:true even though the person signed up through a klaivyo sms form and I see consent when I look them up in klaviyo :/

 

 

Userlevel 4
Badge +3

Hi @AR99  

Would you mind passing along an example request so I can take a closer look? 

Thanks so much!

Kelsey 

Reply