A partial archive of meta.discourse.org as of Tuesday July 18, 2017.

Whiltelisted Discourse app with Push Notifications via OneSignal

pmusaraj

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 DiscourseMobile fork - which is used to build the app


For now the app works only on iOS. Android version should be coming soon.

Instructions for setting this up for your own app:

  1. Register an App ID on the Apple portal (developer.apple.com)
  2. Open an account with OneSignal (free), create a new app, and generate certificates for iOS using the OneSignal provisionator (or generate certs on the Apple portal)
  3. 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.)
  4. Create an iCloud container and associate it with your App ID.
  5. Checkout Discourse-Mobile locally, and get started setting up your environment and building the app using the steps described in the repo: https://github.com/pmusaraj/DiscourseMobile
  6. Edit global.js to set your app's variables: site domain, app name, OneSignal App ID and URL scheme (optional).
  7. Make sure you have Node installed, and run node setup.ios.js from your command line. This will use the variables set in global.js to update the app files.
  8. Load XCode, open Discourse.xcodeproj and update your Bundle identifier and your Provisioning profiles.
  9. Now, jump over to your Discourse instance and make sure you are running your site on https. The OneSignal plugin does not support http at this point.
  10. Add the discourse-onesignal plugin to your Discourse instance and configure it: enable notifications, add your OneSignal App ID and the OneSignal REST API key.
  11. You should now be ready to build and test the app in Xcode our using react-native run-ios on the command line. (To test push notifications, you need to set up your app on your phone, either via ad-hoc or through TestFlight.)

If anybody is interested in testing this using a demo Discourse instance, I have a demo site set up at white.saloncms.ca. Please respond below with your email address if you are interested in testing. The demo is offline for now.

Upcoming improvements:

  • the home screen of the app needs to be improved a little bit. the official Discourse app accepts connections to multiple sites. The whitelisted app is geared towards a single site. So that home screen is a little raw and empty. I'm working on a better UI for it. (PRs and suggestions welcome.)
jeromeclatworthy

Phenomenal work! Looking forward to the andriod and home screen fixes.

mitchellk

Good work, amazed you managed to get push working on iOS when Apple refuses to allow push from OneSignal and other sites.

pmusaraj

Thanks, folks. @mitchellk Apple refuses push from OneSignal? Odd...

For general information: I did run into an issue with the ios app review process, my app submission was refused on the grounds that it sufficient different from a mobile website experience (which is a fair point...). I need to modify the app a little more so that it offers a bit more content right away.

So, some success, but not quite there yet, unfortunately.

mitchellk

Think I was mistakenly referring to iOS refusing web push.

But building it as an app will allow push with OneSignal.

WorldIsMine

Are you for hire? Would love to have this implemented (with Android too)

Ham

Im with @WorldIsMine I’d pay to have this implemented on my site. I have a wrap around app for my android now but no notifications. The biggest complaints I get on my group is no one wants the discourse app to access it due to too much setup and clicks. Everyone is asking for notifications as well.

WorldIsMine

We are working on a all-in-one solution right now, I will update this thread if we complete the project. I am amazed to see so little is being done in this field. It’s all about mobile these days, this needs to get done.

Ham

Thanks. I lost hundreds of members when I switched from vbulletin/tapatalk to here. But i do like the format here better and the members that stayed liked the format better too. I was hoping to find someone to integrate the tapatalk api with this but I dont think its an easy task.

Edit: being on tapatalk increased my members by a huge amount for people that could search and join thru there.