SMS Consent can be passed server-side via our Lists API. You can find additional guidance in our Help Doc here. We additionally have information for passing consent using Zapier here.
If you are looking to pass consent client-side, you’ll want to use the ajax/subscribe endpoint. We have sample code here to illustrate how this works. We recommend passing consent server-side when possible, but this is a good option if using legacy forms.
Remember that for all SMS consent methods (server-side or client-side), there are a few default requirements:
-
Phone numbers must be valid and properly formatted. You can find acceptable phone formats here.
-
Phone numbers must come from the regions that Klaviyo supports for SMS. Currently, we support SMS for US, Canada, UK, and Australia. We will not store consent for phone numbers outside of these countries.
-
Your Klaviyo account must have SMS enabled.
-
You must have a sending number that corresponds to the region you want to collect consent for. In other words, if you want to pass consent for US phone numbers, you must have a toll-free number or US short code. If you want to pass consent for Australian numbers, you must have a branded sender ID or AU long code. For more information on phone number types per region, check out these docs: US/CAN or UK/AU