# 使用 OneSignal 的白名单 Discourse 应用推送通知

**URL:** <https://meta.discourse.org/t/whitelisted-discourse-app-with-push-notifications-via-onesignal/58247>\
**Category:** Plugin\
**Tags:** broken\
**Created:** [2017 年3 月 2 日 18:27 UTC](https://meta.discourse.org/t/whitelisted-discourse-app-with-push-notifications-via-onesignal/58247 "2017-03-02T18:27:22Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)\
发布日期： [2017 年3 月 2 日 18:27 UTC](https://meta.discourse.org/t/whitelisted-discourse-app-with-push-notifications-via-onesignal/58247/1 "2017-03-02T18:27:22Z")

</div>

Following up on the discussion [here](https://meta.discourse.org/t/what-if-i-want-to-white-label-the-discourse-mobile-apps/53063/9), 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](https://github.com/pmusaraj/discourse-onesignal/)** - a Discourse plugin that sends Push Notifications to OneSignal’s REST API

and a **[Discourse Mobile Single Site App](https://github.com/pmusaraj/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](http://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.)

---

_[View the full topic](https://meta.discourse.org/t/whitelisted-discourse-app-with-push-notifications-via-onesignal/58247)._
