Pushpad Logo Pushpad

Pushpad Pro: Getting started

Your website must be served over HTTPS in order to use Pushpad Pro due to security restrictions imposed by browsers. If you don't have HTTPS you can use Pushpad Express.

First of all create a new sender for your domain.

Then create a new project and select your sender.

After the project is created, you have to add this file to the root folder of your website:

service-worker.js
importScripts('https://pushpad.xyz/service-worker.js');

Then copy and paste the following code on your website just before </head>:

<script>
  (function(p,u,s,h,x){p.pushpad=p.pushpad||function(){(p.pushpad.q=p.pushpad.q||[]).push(arguments)};h=u.getElementsByTagName('head')[0];x=u.createElement('script');x.async=1;x.src=s;h.appendChild(x);})(window,document,'https://pushpad.xyz/pushpad.js');

  pushpad('init', PROJECT_ID);
  pushpad('subscribe');
</script>

PROJECT_ID must be replaced with your project ID: you can find it in the project settings.

Check out the other documentation sections for more details. For example you can learn more about the Javascript SDK and how to send push notifications.

Working locally

The easiest solution for development is to use localhost. In that case you don't need SSL. However if you are testing using Safari the address must be http://localhost: do not use custom ports nor the ip address. You also need to pass hostname as an option to 'init' as described in the API reference.

A better solution would be to make the local environment look like the production one: for example add something like 127.0.0.1 example.com to /etc/hosts and use real SSL certificates (self-signed certificates don't work).