Discourse Push Notifications


(Alan Tan) #1

:warning: In order for this plugin to work at all, your Discourse MUST BE HTTPS!

The plugin repository is at github.com/discourse/discourse-push-notifications

Supported Browsers

Chrome Desktop / Mobile 51 and up, Firefox Desktop 44 and up, see caniuse for specifics.


Be on a recent version of Discourse running HTTPS, then follow Install a Plugin.


  1. Enable push notifications for your user
  2. Run this command from your rails console: DiscoursePushNotifications::Pusher.push(User.find_by(username: '<your username>'), {})

You should receive a push notification almost immediately.

Push notifications on Android (non-hosted sites)
Android chrome & notifications
Its a real struggle to move my team across from Slack, they miss the mobile notifications. how did you solve this?
Troubles with Push Notifications setup
Better terms for watching (and tracking?)
URL off by one when moving through posts with keyboard
How to upload files in root directory?
Custom_fields simultaneous save with json becomes an array
Troubles with Push Notifications setup
Webhooks / Pushover / Push Bullet
Android live notifications are now in core!
Babble - A Chat Plugin [ARCHIVE]
Console - Invalid response after removing Push notifications plugin
(Joshua Rosenfeld) #6

On Desktop can you explain (or show) the difference between Desktop Notifications and Push Notifications? (Using Chrome, Windows 10 if that matters).

(Rafael dos Santos Silva) #7

The advantage of using push messages is that even if your page is closed, your service worker will be woken up and be able to show a notification. Web Sockets and EventSource have their connection closed when the page or browser is closed.

(Jeff Wong) #22

This is awesome, thank you!

Just a few questions about how it all works – Can you summarize how this would play with other notification targets? Such as if you have both push notifications enabled and allow desktop notifications enabled, will you get notified twice? And if a service worker delivers a message, will you get an email?

(I’m asking for clarity, as I push ‘install’ hard enough to break my finger.)

(Rafael dos Santos Silva) #24

The description of the button says that push disables desktop notifications.


(Tomek) #153

Is it possible to notify users of this function and encourage them to accept push notifications?
Currently this setting is hidden and it’s really hard to notice it.

(Diego Barreiro) #154

Well, you can edit system/discobot/account welcome message to show the feature for new users, I guess

(Jeff Wong) #165

User preferences -> notifications -> push notifications.

Not to be confused with “desktop notifications.”

The plugin recently changed to use an open push protocol called vapid. That’s the reason why you don’t need keys anymore.

iOS doesn’t support push notifications without installing an applications, and using their push API as far as I know. Perhaps your moderator was getting notifications through the discourse iOS app?

(Daniela) #167

I think that you can use this method with a proper query:

(Jeff Atwood) #168

I deleted a ton of old obsolete commentary here. @awole20 I made the first post wiki can you make sure it’s good and up to date?

(Jeff Wong) #169

Done - Just moved and updated the references from the old troubleshooting steps. Everything else is current.

(Mukul Dilwaria) #170

Can some one explain in proper steps , how to install
i did git clone and run the server again (.yml again) , but nothing happened

(Daniela) #171

(Stephen Chung) #172

I guess there is no way to automatically enable Push Notifications for a user?

He/she has to do it on the particular browser, right?

(Daniela) #173

Via rails console you can automatically enable push notifications for a user or for all your users only on Discourse.
But the user must give the consensus to the browser manually. So, for practical purposes, you are right.

(Stephen Chung) #174

Can you post the command here to enable push notifications for all?

(Daniela) #175

You should be able to enable settings in this way (i’m not sure because it’s a plugin):

Then you should change the code here and adapt it to all users instead of one

DiscoursePushNotifications::Pusher.push(User.find_by(username: '<your username>'), {})

to see if notifications are sent.

I do not know if there is a limit of notifications that can be sent concurrently or in a day, probably yes.


(Felix Freiberger) #176

I’m pretty sure that push notifications cannot be enabled for all users because this requires consent within their browsers:

The best you can achieve is the browser asking the user for permission as soon as he opens the page, but in that case, I’m afraid that many users will reject.

(Stephen Chung) #177

Well, actually, when running a private forum, users can be told to accept notifications when they sign-on.

(Stephen Chung) #178

@Trash, I don’t think it is as simple as that.

The user custom field discourse_push_notifications holds a particular service worker subscription info. I think it is only done on the browser when the user presses “Enable”.