SDK Reference

The SDK is used to subscribe a visitors to Webpushify and start sending push notifications to them.

Note: You need to set up your Website and SDK before using it. Please, take a look at Setup Webpushify .

init command

You must call the init command to initialize the SDK and set the websiteId.

<script>
webpushify('init', 'YOUR_WEBSITE_ID');
</script>

Note: Please, replace the string YOUR_WEBSITE_ID for your website id.
The website id is automatically generated by the system.
You can find your website id in the Edit Website screen. For example, 01DZ91SZPH2NCJHMQB14P7JK3S

subscribe command

You call the subscribe command to subscribe the visitors or update existing subscription using the native support.

This command shows the Native Browser Permission Prompt. Only HTTPS websites can show the native browser prompt.

<script>
webpushify('subscribe');
</script>

showConfirmBox and showBell commands

The showConfirmBox and showBell commands are the easiest way to collect subscriptions.
These widgtes are soft way to ask for permission to send notifications.
The widgtes sit at the bottom left or right corner of your Website. They are completely configurable from your dashboard.
For further details, please, take a look at Widgets .

<script>
webpushify('showConfirmBox');
</script>
<script>
webpushify('showBell');
</script>

Use Cases

You can call the subscribe, showConfirmBox and showBell commands as soon as your visitors enter your website.

Although, this is not the best strategy from the user experience perspective, it is definitely a method to capture the visitors attention.

You can make the calls on specific pages or the whole website while the page is loading or associated to an event (a button click).

Note: Be careful with the subscribe command. If the visitor blocks the browser prompt, your website cannot display the browser prompt again.
An alternative strategy is to use a soft prompts like showConfirmBox and showBell commands.