Skip to content

Quickstart

Add the snippet, host sw.js on your domain and send your first notification.

relaybell adds web push notifications to any website. Drop in a snippet, and you can collect subscribers and send notifications — with automation, targeting, and analytics — in minutes.

Grab your Project ID from your dashboard (Install page). On WordPress, use the plugin instead — it does steps 1 and 2 for you.

1. Add the snippet to every page, just before </body>:

HTML
<script src="https://relaybell.com/relaybell-sdk.js"></script>
<script>
  RelayBell.init({ projectId: "YOUR_PROJECT_ID", apiBase: "https://relaybell.com" });
</script>

Building with a JavaScript framework? See Next.js, React or Vue and Nuxt.

2. Host the service worker. Download sw.js and upload it to the root of your site, so it opens at https://yoursite.com/sw.js. Browsers only run a service worker from your own domain, so push can't work without this file. (Can't put it at the root? See Installing the SDK.)

Warning

Your site must be served over HTTPS: browsers allow service workers and push only on secure pages (http://localhost works for testing).

3. Send. relaybell now shows your opt-in prompt, subscribes visitors and stores them. To send from your server, create an API key under Settings → Developers → API keys and POST to the REST API (see Sending) — or send from the dashboard.