Skip to main content
Web push notifications let you reach users with timely, relevant messages even when they aren’t actively browsing your site. The Tappd Web SDK uses the native Web Push API with VAPID keys, so notifications work across all modern browsers with a single integration.

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.js file 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

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

1

Configure Web Push in the Dashboard

  1. Log into your Tappd Dashboard.
  2. Navigate to Settings > Apps and select your web app.
  3. Go to Push Configuration > Web Push.
  4. Toggle Web Push on.
  5. Click Generate Keys to create your VAPID key pair.
  6. Optionally set a Default Icon URL and Site Name for your notifications.
2

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:
The service worker file must be served from the root path (/sw.js). A file at /assets/sw.js will not have the correct scope to intercept push events.
3

Identify the User and Subscribe

Users must be identified before you subscribe them to push notifications. Call identify() first, then subscribeToPush():

Checking and Managing Subscriptions

Subscribe a User

Call subscribeToPush() 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.
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:
  1. Go to Settings > Apps > [Your App].
  2. Scroll to Web Push Configuration.
  3. Click Test Web Push.
  4. Select a customer and fill in the notification details.
  5. Click Send Test Push.

Troubleshooting

Likely causes:
  • The sw.js file 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.
Fix: Open https://yourdomain.com/sw.js in your browser to confirm the file is accessible. Check the browser console for registration errors.
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.
Work through this checklist:
  1. Call await tappd.isSubscribed() and confirm it returns true.
  2. Verify VAPID keys are generated and saved in the dashboard.
  3. Confirm the service worker is active — check the Application > Service Workers panel in DevTools.
  4. Ensure identify() was called with a valid external_id before subscribing.
  5. Verify the notification was actually sent from the dashboard or API.
Push subscriptions can expire or be revoked by the browser.Fix: Poll isSubscribed() periodically and re-subscribe when needed: