Prerequisites
Before you configure push notifications, make sure you have the following in place:- HTTPS: Web push requires a secure origin (HTTPS). Localhost is exempt during development.
- Service worker: A
sw.jsfile must be accessible at the root of your domain. - VAPID keys: Generated automatically in the Tappd dashboard — no manual key management needed.
- Identified users: Users must be identified with
identify()before you subscribe them.
Browser Support
| Browser | Support |
|---|---|
| Chrome (Desktop & Android) | ✅ |
| Firefox (Desktop & Android) | ✅ |
| Edge | ✅ |
| Safari 16.4+ (macOS & iOS) | ✅ |
| Opera | ✅ |
| Safari < 16.4 | ❌ Not supported |
Safari 16.4+ uses the standard Web Push API with VAPID keys — the same flow as Chrome and Firefox. No separate Apple certificate is required for modern Safari.
Setup
Configure Web Push in the Dashboard
- Log into your Tappd Dashboard.
- Navigate to Settings > Apps and select your web app.
- Go to Push Configuration > Web Push.
- Toggle Web Push on.
- Click Generate Keys to create your VAPID key pair.
- Optionally set a Default Icon URL and Site Name for your notifications.
Create the Service Worker
Create a file named
sw.js at the root of your domain (e.g., https://yourdomain.com/sw.js). Copy the following code into it:Checking and Managing Subscriptions
Subscribe a User
CallsubscribeToPush() after identifying the user. It accepts an optional options object:
Check Subscription Status
Before prompting the user, check whether they’re already subscribed:Unsubscribe a User
Give users a clear way to opt out:Permission Prompt Types
Choose the prompt style that fits your UX. You can configure the default in the dashboard or override it in code.- Slidedown (Default)
- Bell Icon
- Native Browser
- Custom UI
A customizable slide-down banner appears at the top of the page, letting you explain the value of notifications before the browser prompt appears.
Sending Notifications
From the Dashboard
Navigate to Templates > Push Templates, create or select a template, then attach it to a Journey. Target the Journey at specific customers or segments to send.
From the API
Use the Tappd Management API to send notifications programmatically from your backend.
Testing
Send a test notification directly from the dashboard:- Go to Settings > Apps > [Your App].
- Scroll to Web Push Configuration.
- Click Test Web Push.
- Select a customer and fill in the notification details.
- Click Send Test Push.
Troubleshooting
Service worker is not registering
Service worker is not registering
Likely causes:
- The
sw.jsfile is not served from the domain root (/sw.js). - The page is not served over HTTPS (required in production).
- The service worker file URL returns a 404.
https://yourdomain.com/sw.js in your browser to confirm the file is accessible. Check the browser console for registration errors.User denied the permission prompt
User denied the permission prompt
Once a user denies browser-level notification permission, the browser blocks future prompts from that origin.Fix: Use a custom UI prompt to explain the value of notifications before triggering the browser dialog. This gives users the context they need to accept. If denied, surface a settings link so users can re-enable notifications at their own pace.
Notifications are not being received
Notifications are not being received
Work through this checklist:
- Call
await tappd.isSubscribed()and confirm it returnstrue. - Verify VAPID keys are generated and saved in the dashboard.
- Confirm the service worker is active — check the Application > Service Workers panel in DevTools.
- Ensure
identify()was called with a validexternal_idbefore subscribing. - Verify the notification was actually sent from the dashboard or API.
Subscription has expired or become invalid
Subscription has expired or become invalid
Push subscriptions can expire or be revoked by the browser.Fix: Poll
isSubscribed() periodically and re-subscribe when needed: