Whitelisted Discourse app with Push Notifications via OneSignal

(Penar Musaraj) #1

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:

  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 and Android
  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-single-site-app locally, and follow the instructions described in the repo
  6. Independently, make sure your Discourse instance is running on https. The OneSignal plugin does not support http.
  7. 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.
  8. 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.)

(This post was revised on October 9, 2017. It uses a standalone app now, instead of a Discourse Mobile fork.)

Looking to hire an app developer for native Discourse
Facebook Groups - Zuck is coming for us
Webhooks / Pushover / Push Bullet
iOS Mobile App Notifications
Custom, white label mobile apps
Uploading to discourse
[Hiring] Whitelisted app
Implementing Push Notifications to the Native apps iOS and Android
Auto generation of user api keys for push notification
(Jerome Clatworthy) #4

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

(Mitchell Krog) #5

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

(Penar Musaraj) #6

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.

(Mitchell Krog) #7

Think I was mistakenly referring to iOS refusing web push.

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

(DaveK) #8

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

(Roland) #9

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.

(DaveK) #10

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.

(Roland) #11

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.

(Penar Musaraj) #12

Major update: I have created a separate project instead of the DiscourseMobile fork.

This new repo is already in use in a live ios and Android app: look for SWAPD on the app stores.

Thanks to @WorldIsMine for funding this work.

(DaveK) #13

The app rocks! Thank you very much. Hopefully, we can work on it down the line to improve it even further.


@pmusaraj - Thanks for putting this code out there, one question. We currently host our forum on digital ocean, I’m wondering if we setup this app (either ios or android) would it share the same backend? Meaning, if a user post a comment via the standalone app, it would also show up for users on the web? I understand I can’t just cut and paste the code to make it work this way, but wondering if there is something there to setup this configuration?

(Penar Musaraj) #15

The app is a wrapper around your Discourse site. Any action (post, like, bookmark, whatever) is done on the Discourse site. So, yes, that action would show up for all users.

(DaveK) #16

I am surprised more people aren’t jumping on this. Having a white-label, dedicated app does wonders for activity.

(Evan Bourcier) #17

I’m super interested in this - we recently moved from a FB group to discourse, and push notifications are a big request of our users. I’m slightly unclear on execution - is this something I can easily enable for users now, or do we need custom work done?

(Evan Bourcier) #18

I’m specifically super interested in just having our community accessible on the App Store like SWAPD, and have cash for anyone who can make that happen.

(James Mc Mahon) #19

thanks for doing this. I think I’ll have a go at adapting this for our community. One thing I noticed on the SWAPD app is that left swipe to go back doesn’t seem to work. Is that difficult to resolve?

(Penar Musaraj) #20

left swipe to go back is on the wishlist, but I haven’t found a way to do that in React Native. I looked into it at some point, but didn’t figure it out. I may look into it at some point in the near future.

(DaveK) #21

Hey, SWAPD owner here. We currently resolved this by adding subtle back/forward buttons on the mobile version via a simple HTML edit (see bottom of screenshot). While it’s not swipe to go back, it goes give the back/forward functionality in a simple way.

(DaveK) #22

@pmusaraj did everything for me, he was super professional. It’s a challenge for sure to get everything set up, especially getting approved by iTunes. It took @pmusaraj 6-8 weeks of constant denials, phone calls, resubmissions to get in the app store. However, I believe since he laid out the ground work now, things should run smoother.