How To Import Web Push Subscribers To A New Push Notification Platform
Website Notifications allows you to engage with users on a real-time basis on desktop and mobile. You don’t need any Mobile Application to send notifications on mobile.
Implementing push notifications on a website is very simple. However, if you want to implement push notification without vendor lock-in, it requires some effort, as outlined in our guide. This will help you to import push subscribers when you migrate to a new Push Notification vendor or platform. You will get the best push notification service at PushEngage.
Many times we are not satisfied with the vendor and want to switch to other push notification vendors. In such a case, make sure to import all your push subscribers. Before you move to a new vendor, check the top features a web push notification service provider should have.
Before we proceed to how to import push subscribers, let’s check how the push subscription and notification works
There are three files which are vital when it comes to Push Notification:
- [HTTPS sites only] manifest json file – You need to put this file in the root folder of your website
What to do when migrating from other Push Notification Vendor
What is A Service worker file?
When a user comes to your website, push notification opt-in is shown to him. Once he subscribes, then Push Notification messages start getting displayed on their browser. Service worker file runs in the client browser and is used to display any new notification for that domain. If there is any notification, service worker will display the notification and on a click, it will take the user to the landing page.
Service worker files are supported only on an HTTPS website. Hence Push Notification works only on an HTTPS website. However, if you don’t have HTTPS website, you can use Push Notification in two ways:
- Use the vendor’s platform to capture subscribers: For e.g., if your website name is http://example.com, you can use https://example.pushengage.com, which we provide by default.
- Create an HTTPS sub-domain to capture subscribers: For e.g., if your website name is http://example.com, you can create an HTTPS subdomain like https://notifiy.example.com.
For more details on Service worker, check Google Developer’s introduction here.
What is Manifest.json File?
Manifest.json file is required to get the push subscription. The manifest file contains the FCM key which is needed for the push subscription to be delivered. To read more about what is FCM key and how you create one, check our post on creating Firebase Cloud Messaging key
What to do when migrating from other Push Notification Vendor?
- Replace Service Worker file for the new vendor: Service worker files are specific to each domain. When migrating: Replace the old service worker file to new service worker file from a new vendor.
At PushEngage, we call service worker file as service-worker.js. At some other vendor, it may be called background-worker.js, or sw.js. Name differs but the functionality remains same. Below is an example screenshot of a service-worker.js file contents in PushEngage:
Service worker files are placed in the root folder of your HTTPS website:
2. Keep the same FCM key in the manifest. json: Manifest.json contains the FCM key which is unique to every domain. Without your own FCM key, you cannot import push subscribers to other vendors. While migrating:
- Keep the same FCM key with the new vendor
- Below is a screenshot of manifest.json file:
If you also have an android app, you will have extra lines for manifest.json and these can easily be merged.
Manifet.json file is located in the root section of your website:
Conditions To Meet For Successful Migration
Migration from old vendors to new vendors is possible if the below two conditions are met:
- FCM Key: You are using your own FCM key to capture subscribers, or have access to vendor’s FCM Project ID/API Key
- Subscription Domain: Push Notification Subscribers are captured in HTTPS domain
Below table will show you all the possibilities where migration can be successful. Consider https://example.com is your domain.
|Subscription Obtained At||FCM Status||Migration Possible Or Not?|
What is the Next Step in Migrating to PushEngage from other Push Notification Vendor?
Next step to import push subscribers to a new vendor:
- Export the users in excel file, with separate export for the different browser (Chrome, Firefox, Safari, etc)
Send the export file to us, and we will test the data and then importing of your subscribers will be done.
Will The Subscribed Users Have To Subscribe Again?
No, your subscribed users need not subscribe again. Your push notification subscribed users will be migrated to the PushEngage platform. You will be able to send notifications to them from your new platform.
Where Will The New Subscription Happen?
All the new subscription will happen on your new platform. Once you update the manifest.json and service-worker file, the subscription will happen as usual. New users will be prompted with the Push Notification Opt-In. Once they allow they will get added to your subscribers’ list. You can select from different push notification opt-in that suit your website.
My service-worker File Has Different Name. What To Do?
Different vendors give names to the service-worker file. If your old service-worker name is the same as the new one, then just replace the content of the old file with the new one. If the service-worker name is different, then you can remove the old file or leave it. Since you will be using new service-worker file which has a different name from the old one, it will work fine.
Can I send a notification immediately after an import?
For your old subscribers to migrate, if the service worker file name is different, then it will take some time for this change to propagate. If you have a higher number of repeat traffic then the subscribers’ list will get updated fast. We expect in next 3 to 4 days that most of your imported subscribers would be reachable.
If you are looking for OneSignal alternative, start using PushEngage. We are the best alternative to PushCrew platform as well. We offer free service to import subscribers from other push notification platform.