Following up on the discussion here, I have successfully set up a fork of the official Discourse app that can send push notifications via the OneSignal API.
There are two parts to this:
discourse-onesignal - a Discourse plugin that sends Push Notifications to OneSignal’s REST API
and a Discourse Mobile Single Site App built similarly to the official Discourse Mobile app (using React Native), but using OneSignal for notifications and a simplified interface to suit the needs of a single app.
Instructions for setting this up for your own app:
- Register an App ID on the Apple portal (developer.apple.com)
- Open an account with OneSignal (free), create a new app, and generate certificates for iOS and Android
- Create the provisioning profiles on the Apple portal. You need a distribution profile for pushing to TestFlight and the App Store, and likely an ad-hoc profile for testing quickly on your device. (Note that you may also need a development certificate for testing the app on your device. Step 2 above creates only the production certificate.)
- Create an iCloud container and associate it with your App ID.
discourse-mobile-single-site-applocally, and follow the instructions described in the repo
- Independently, make sure your Discourse instance is running on https. The OneSignal plugin does not support http.
- Add the
discourse-onesignalplugin to your Discourse instance and configure it: enable notifications, add your OneSignal App ID and the OneSignal REST API key.
- You should now be ready to build and test the app in Xcode our using
react-native run-ioson the command line. (To test push notifications, you need to set up your app on your phone, either via ad-hoc or through TestFlight.)
(This post was revised on October 9, 2017. It uses a standalone app now, instead of a Discourse Mobile fork.)