An unofficial OneSignal / WordPress Integration. I currently work at OneSignal, however this is in no way affiliated to OneSignal. If you're looking for the official plugin, go here: OneSignal WordPress Plugin
- 🚀 Initialises the latest OneSignal Web SDK (v16).
- ⏩ Automatically sends Push Notifications when a WordPress post is published.
- 💬 Setup prompts within the OneSignal dashboard. No custom code required.
- 🧑🤝🧑 Choose which Segment should recieve notifications for each post.
- 📑 Web Topics included by default.
- 📲 Send to mobile app subscribers, with an option to direct them to a different URL (Deep Link).
- In your WordPress admin screen, click Plugins -> Add New Plugin -> Upload Plugin -> Choose file
- Choose onesignal-main.zip and click Open
- Click Install Now
- Click Activate Plugin
- You're done, and should see UnoSignal in your admin menu
- A OneSignal account.
- A OneSignal app, with Web Platform enabled.
- The OneSignal App Id and REST API Key (Keys and IDs).
- On the Web Platform configuration page, choose Typical Site Setup
- On the Typical Site Setup screen, under Advanced Push Settings, switch on Customize service worker paths and filenames
- Where it asks for Path to service worker files and Service worker registration scope, enter
/wp-content/plugins/unosignal-main/service_worker/
(screenshot example below). - Where it asks for Main service worker filename and Updater service worker filename, enter
OneSignalSDKWorker.js
(screenshot example below). - Save the Settings page. You'll be directed to a new page with Upload Files and Add Code to Site, ignore this and click Finish at the bottom of the page.
- Enter the OneSignal App Id and REST API Key (Keys and IDs).
- Save Changes
- You should see a check below each field. That's it!
- Whilst creating a Post in WordPress, you should see a metabox for OneSignal Push Notifications.
- Check Send notification when post is published, and choose the Segment you'd like to target.
- By default, a notification will use the Post title and an excerpt of the Post content. It will also include an image, if the post has a featured image.
- You can customise the Title and Content of a notification by checking Customize notification content. You can also customise the Mobile URL (more on this below).
- When you Publish the post, a notification will be sent.
- If you also have a mobile app setup in OneSignal, that's separate to your Website, you can switch on Send notification to Mobile app subscribers (in the plugin settings screen). This will include subscribers from your Mobile app in the notification send.
- In the OneSignal Push Notifications metabox, you can choose a different URL for your Mobile app subscribers (Deep Link) – If you do not include a different URL, it will direct them to your Website, rather than a specific page of your app.