You can register a user's phone number for SMS and WhatsApp directly from your website using the Web SDK's registerSmsNumber and registerWhatsappNumber API methods.
Here is an example of how to use these methods in your JavaScript code:
Pushwoosh.push((api) => {
// Register an SMS number
api.registerSmsNumber('+15551234567');
// Register a WhatsApp number
api.registerWhatsappNumber('+15551234568');
});
Pass each number in E.164 format: a leading +, the country code and digits only, with no spaces, dashes or brackets. A number in any other format is rejected by the SDK with an "Invalid ... number format" error.
These methods associate the provided phone numbers with the current user's profile. For the full list of Web SDK methods, see Web push SDK 3.0.
Comments
0 comments
Please sign in to leave a comment.