Hey @Dbuglab,
I just wanted to put that out as a suggestion but I can understand what you are trying to achieve.
Currently, we don't have an easy way to get a "yes" for SMS consent. As of now, you can pass us a list of phone numbers using the get-list-subscriptions
endpoint and if that phone number is not returned in the response, that will indicate that it is not consented.
When a Klaviyo profile consents to receive SMS, it shows up visually in the profile with the little green checkmark and it triggers the event "Consented to Receive SMS". The only way for those things to happen is for a Profile to have consented.
In order for a Klaviyo profile to consent to receive SMS in a Klaviyo-recognized way, this must occur via one of the mechanisms described here - e.g. a native Klaviyo form, supported consent at checkout experience, click-to-text, etc. It is not sufficient to simply update a profile through the Track or Identify API, even if you set a property like sms_consent
that also gets set via these other mechanisms.
If setting consent via API, you need to use our Lists API.
If using hosted pages or legacy forms, the recommended way to hit the Lists API is via the ajax/subscribe endpoint.
That endpoint is picky about the structure/syntax of the request - so we have an example here to illustrate how it works.
Lastly, remember that even if you do all of these things perfectly there are still other requirements to getting consent - e.g. you have to have a valid phone number, it must be in a supported geo, and the Klaviyo account must have SMS enabled.
Have you taken a look at our Guide to Collecting SMS Consent via API documentation? Was there something on there that you specifically ran into errors with?
Looking forward to hearing your thoughts and working with you,
Alex