Auto-posting to Web Push OneSignal
OneSignal provides Push Notification delivery and automation. We have SDKs for iOS, Android, Amazon, Windows Phone, Unity 3D, Phonegap, Marmalade & more!. https://onesignal.com/
To configure a channel for Web Push notifications, we recommend to get familiar with the starters guide:
Once the previous step is completed, the configuration of a Web Push channel follows these steps:
- Creation of the account and the associated platforms
- Service Worker installation
- Enable System - Joocial Webpush plugin
- Create the channel Web Push - OneSignal
Please, visit Joocial News to review how Web Push notifications works, powered by OneSignal.
Creation of the account and the associated platforms
OneSignal provides a unified service to integrate Chrome, Firefox and Safari platforms. At the end of the account configuration, you must have the following IDs and keys to configure Joocial:
- App Settings/ Keys & IDs/ App ID
- App Settings/ Keys & IDs/ REST API Key
- Account/ Account & API Keys/ User Auth Key
- Safari Website Push ID (Optional, required if you are also integrating Safari)
Please, follow these guidelines to configure the platforms:
- Web Push Setup - Getting started with web push notifications
- Web Push SDK Setup (HTTPS) - OneSignal SDK Setup Guide for HTTPS websites. Works with all Web Push platforms (Chrome, Firefox, Safari) RECOMMENDED
- Web Push SDK Setup (HTTP)
- Accounts and Keys
Please, double check to have all the required IDs and Keys, before proceeding with the rest of the configuration: App ID, REST API Key, User Auth Key and Safari Website Push ID (Optional).
Service Worker installation
Service workers are declared with a manifest and several files in the root folder.
- Manifest definition
- Service worker files installation
To simplify this task, we have created a plugin to generate the manifest: Ajax - Webpush Manifest Definition for Joocial
Enable the Webpush Manifest Definition plugin:
Service workers are declared with a manifest and several files in the root folder. To simplify this task, we have created a plugin to generate the manifest: Ajax - Webpush Manifest Definition for Joocial
The plugin generates a basic manifest to declare the Web Push service. If you already have other service workers, then you must follow the manual installation steps, and configure the manifest according to your requirements.
Once the manifest is defined, only the service specific files must be copied in the root folder (OneSignalSDKUpdaterWorker.js and OneSignalSDKWorker.js), as shown below.
Service worker files installation
To configure the Service Worker, two files must be copied to the root folder of your website. You must access the main directory of your site (with FTP or your hosting control panel. E.g. /home/myusername/public_html) and copy these files:
As an example, you can inspect the files that are configured in Joocial News:
- OneSignalSDKUpdaterWorker.js - https://news.joocial.com/OneSignalSDKUpdaterWorker.js
- OneSignalSDKWorker.js - https://news.joocial.com/OneSignalSDKWorker.js
TIP for Akeeba Admin Tools (or any other firewall)
By default, Admin Tools does not allow the access to these files since they are not part of a standard Joomla site. To enable the access, please add them into "Exceptions / Allow direct access to these files".
The original files, provided by OneSignal, can be downloaded here: Web Push SDK Setup (HTTPS) - Upload required files. Download and unzip the SDK files.
- Web Push SDK Setup (HTTPS) - Upload required files. Download and unzip the SDK files.
- Web Push SDK Setup (HTTP)
Enable System - Joocial Webpush plugin
Access your Joomla administrative area, visit the Plugin manager and configure the System - Joocial Webpush plugin.
Create the channel Web Push - OneSignal
These steps are similar to the rest of the channels. Please, fill the fields, validate and save the channel.
New created channel
Web push subscription available on the front-end site
Web push unsubscription available on the front-end site
After this final configuration, the channel will be ready to publish notifications in the same way than the rest of the channels.