SMS SDK Methods

Collect and remove SMS Numbers through your app or website.

OneSignal's Mobile and Web SDKs provide methods for adding and removing phone numbers (aka SMS subscriptions) from a user record.

These methods require OneSignal Mobile SDKs 5.0.0+ and Web SDK 160000+.

Adding a phone number

πŸ“˜

Use Identity Verification

If you have a backend server, we strongly recommend using Identity Verification with your users. Your backend can generate an SMS Authentication Token and send it to your app or website.

Add a new SMS subscription (phone number) to the current user. Requires phone numbers to follow the E.164 international telephone number plan.

OneSignal.getUser().addSms("+15558675309")
OneSignal.User.addSms("+15558675309")
[OneSignal.User addSms:@"+15558675309"];
OneSignal.User.addSms("+15558675309")
OneSignal.User.AddSms("+15558675309");
OneSignal.User.addSms("+15558675309");
OneSignal.User.addSms("+15558675309");
OneSignal.User.addSms("+15558675309");
window.plugins.OneSignal.User.addSms("+15558675309");

Removing a phone number

Remove an SMS subscription (phone number) from the current user.

OneSignal.getUser().removeSms("+15558675309")
OneSignal.User.removeSms("+15558675309")
[OneSignal.User removeSms:@"+15558675309"];
OneSignal.User.removeSms("+15558675309")
OneSignal.User.RemoveSms("+15558675309");
OneSignal.User.removeSms("+15558675309");
OneSignal.User.removeSms("+15558675309");
OneSignal.User.removeSms("+15558675309");
window.plugins.OneSignal.User.removeSms("+15558675309");