Web quickstart
The shortest path to browser push — enable the Web Push channel, add the script tag, place the service worker, request permission and send a test push.
Web Push works in Chrome, Edge, Firefox and Safari 16.4+ (on iOS, as a PWA added to the home screen); HTTPS is required (localhost is exempt). This page gives the shortest setup; for all options see the Web SDK.
Enable the channel
Dashboard → App settings → Channels → Web Push → Enable. The VAPID key pair is generated automatically; provide a mailto: or https:// address as the sender subject. The channel becomes active immediately. Via the API: PUT /v1/apps/{app_id}/channels/web_push (admin).
Add the script tag
<script src="https://api.pushizo.com/sdk-web/PushizoSDK.js" async></script>
<script>
window.PushizoDeferred = window.PushizoDeferred || [];
PushizoDeferred.push(async (Pushizo) => {
await Pushizo.init({ appId: 'app_…' }); // self-hosted: apiUrl: 'https://api.pushizo.com'
});
</script>With npm (@pushizo/web, once published):
import Pushizo from '@pushizo/web';
await Pushizo.init({ appId: 'app_…' });Place the service worker
PushizoSDKWorker.js at your site root:
const apiUrl = new URL(self.location.href).searchParams.get('apiUrl') || 'https://api.pushizo.com';
importScripts(`${apiUrl}/sdk-web/PushizoSDKWorker.js`);If you already have a service worker, add the same importScripts line to it and pass serviceWorkerPath in init. For a file outside the root, the server must send the Service-Worker-Allowed: / header.
Request permission and identify the user
await Pushizo.Notifications.requestPermission(); // bind to a button; the browser prompt requires a user gesture
await Pushizo.login('user_42'); // as soon as you know the identity; devices merge under the same user
await Pushizo.User.addTags({ plan: 'pro' });For the soft prompt (slidedown) and the bell, use the slidedown / bell options of init (prompts).
Send a test push
Dashboard → Subscriptions → mark the record as a Test device → Messages → Send test push. Via the API, use target.test_devices_only: true (first notification). The delivery timeline appears on the Message Tracking screen.
Common issues
- The permission prompt does not open:
requestPermissionmust be called from a user gesture (click); if the browser previously denied it, reset it in the site settings. - No subscription is created: Is the page served over HTTPS? Does
PushizoSDKWorker.jsreturn 200? Turn on the SDK log in the console withlogLevel: 'debug'. - iOS Safari: only PWAs added to the home screen; manifest and setup guide: iOS web push and PWA.
- React/Vue/Angular: framework guides; in SSR frameworks, initialize the SDK on the client side.