Skip to main content

Hi there,

 

I have a website that I’m looking to add a custom styled SMS sign-up form too.

We currently have an email only sign-up that captures users emails, but now want to offer an SMS only sign-up as well.

I’ve updated from v1 API to the latest for the email form and that works fine.

However creating a new subscriber with only the phone_number field and no email seems to silently fail. I get a success response, yet no data in SMS list within Klaviyo.

If i test with a hardcoded email attached then it goes straight through.

 

Is it possible to create a new subscriber with phone_number only?

Or is an email mandatory when posting to the subscription endpoint using ajax - https://a.klaviyo.com/client/subscriptions/?company_id=XXXXXXX

 

Here is the reference doc I have been referring too:
https://developers.klaviyo.com/en/reference/create_client_subscription

 

I have Single opt-in enabled too.

 

Thanks in advance.

Hello @laurtondigital  Yes, You can create a profile with Phone Number only.

 

You can use the API from here https://developers.klaviyo.com/en/reference/create_profile

And the Payload would be

 

{
"data": {
"type": "profile",
"attributes": {
"phone_number": ""
}
}
}

 


Thanks @Maxbuzz for the quick reply.

An ajax request returns a CORS error for me, even over HTTPS.

I’m working within a custom Shopify theme.

 

Once a profile has been created, is it a matter of using this API to subscribe them to a list
https://developers.klaviyo.com/en/reference/subscribe_profiles 
 

 


@laurtondigital  this won’t work on client side. For client side you can use the Javascript API shared on this page:

https://developers.klaviyo.com/en/docs/javascript_api


Thanks @Maxbuzz 

I don’t think that reference was what i was looking for - I believe that is more to do with tracking.

I ended up getting it to work with this reference in the end which is suited to client-side.

https://developers.klaviyo.com/en/reference/create_client_profile

 

Appreciate your assistance and pushing me in the right direction - thank you!


Reply