
The Web Push Notifications for Grav is a plugin for Grav CMS based on OneSignal service. Web push notifications are short messages that come from a website. You get them on your desktop or device even when the website is not open in your browser. It is a new marketing channel to re engage your site visitors without knowing their email or other contact details. All major browsers support Web Push. Android devices may also receive Web Push notifications, in addition to notifications from apps. This plugins is similar to Wordpress one. It lacks some features but it offers powerful ability to notify your subscribers about new pages in your Grav Administration Panel.
To download Grav Web Push Notifications plugin, please go to Github: https://github.com/devlom/grav-plugin-webpush/releases/latest and grab latest Source Code package.
Installing the Web Push Notifications plugin is done in few easy steps. Please review carefully each part. This might be unusual to standard grav plugin procedure but it's required for Web Push Notifications to work.
First of all you will have to register account at OneSignal. After registration, please add new app by clicking "Add App" button in your dashboard. Then select "Web Push".
As an integration please select "Custom Code" (important):
That's it. Configure all required fields (url, your icon, Safari and then hit Save).
This is VERY IMPORTANT step. You have to downlaod OneSignal SDK Files and you have to place them on your domain root.
For example. Your Grav installation is placed at https://yourdomain.com. You have to unzip whole directory and upload all files from this zip to your domain. So they are accessible like:
https://yourdomain.com/OneSignalSDKWorker.js
https://yourdomain.com/OneSignalSDKUpdaterWorker.js
Please don't submit any bugs if files above does not exist in your domain. The same apply for subdomain https://yourdomain.com. Then files must be uploaded to subdomain root:
https://subdomain.yourdomain.com/OneSignalSDKWorker.js
https://subdomain.yourdomain.com/OneSignalSDKUpdaterWorker.js
What about subdirectories ? The same rule apply. Service worker files must be on your domain root. So if you have Grav installation like https://yourdomain.com/grav, then files has to be on your domain root:
https://yourdomain.com/OneSignalSDKWorker.js
https://yourdomain.com/OneSignalSDKUpdaterWorker.js
Don't ask me why is that. This is just how service workers.. works :D. If you're familiar with PWA, then that shouldn't be a news for you :)
After that just continue with regular Grav install.
To install this plugin, just download the zip version of the repository and unzip it under /your/site/grav/user/plugins
. Then, rename the folder to webpush
. You can find these files on GitHub or via GetGrav.org.
You should now have all the plugin files under
/your/site/grav/user/plugins/webpush
NOTE: This plugin is a modular component for Grav which requires Grav and the Error and Problems to operate.
You can use simplest way to install this plugin package via the Grav Package Manager (GPM)
Through your system's terminal (also called the command line). From the root of your Grav install type:
bin/gpm install webpush
This will install the Web Push Notifications plugin into your /user/plugins
directory within Grav. Its files can be found under /your/site/grav/user/plugins/webpush
.
You can install plugin directly through the admin plugin by browsing the Plugins
tab and clicking on the Add
button.
Before configuring this plugin, you should copy the user/plugins/webpush/webpush.yaml
to user/config/plugins/webpush.yaml
and only edit that copy. Plugin has around 50 configuration options. Feel free to experiment with those.
Note that if you use the admin plugin, a file with your configuration, and named webpush.yaml will be saved in the user/config/plugins/
folder once the configuration is saved in the admin.
You can of course send Notifications using onesignal.com WebPanel but we have better idea. Just use our awesome Web Push tab. Tab is added to every page. Just take a look:
All you have to do is polish preloaded data. Check "Send Notification" and hit "Save". Isn't that easy ? How AWESOME is that :) ? Good luck :)
OneSignal Wordpress APP https://wordpress.org/plugins/onesignal-free-web-push-notifications/
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.