Pushpad Logo Pushpad

Pushpad Pro: Getting started

Note that 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. You have to enter the GCM API key and APNs certificate that you have obtained in the Certificates and keys section.

Then create a new project and select your sender.

After the project is created you have to add two files to the root folder of your website:

service-worker.js
importScripts('https://pushpad.xyz/service-worker.js');
manifest.json
{
  "gcm_sender_id": "123456789",
  "gcm_user_visible_only": true
}

Replace the gcm_sender_id with your actual GCM sender id.

Copy and paste the following code into your website just before </head>:

<link rel="manifest" href="/manifest.json">
<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).