Webhooks / Pushover / Push Bullet

Is there a way that anyone knows, to use the Webhooks to push data into the Pushover / Push Bullet API?

What problem exactly are you trying to solve?

Well, I’m trying to find a way to let my users configure push notifications using one of the many push services out there. While I would absolutely love to have the money to have my instance hosted on Discourse’s servers, I simply don’t have it to spend, and it is a feature my most loyal users would very much like to have.

I know that it is your method of making money to support this software, and I respect that, it is wonderful software. I’m just looking for a workaround so that I can get the few users I have something they want, without having to code it entirely from scratch.

You have alternatives:

https://meta.discourse.org/t/discourse-push-notifications/46692

7 Likes

I had seen the first one before, and thank you very much. I am looking into the second one, which really sounds like it could be the gold mine to what I’m trying to do, and I intensely appreciate the link, I had not known it existed. Of course, it will take some study, but I’m happy to do that.

On a side-note, is it possible to pull a single users notification feed via the API?

I’ve been looking through the docs, mainly because I got started for another project (using a script to post notifications from my discourse instance over to a discord server using multiple webhooks) and have found it is more extensive than I anticipated. Thus, I am curious on three counts…

  • Is it possible to pull a single users notification feed?
  • Is it possible to pull a list of all users?
  • If I added a custom field, would that be included in the user information pulled by the API?

Since I’ve already got an architecture in Python to get JSON data from the site and then do things with it, I just wanted to see what else I might do with the notification feed? I was thinking that, if I (for whatever reason) wanted to use Pushover, for example, and added custom fields to the system to store the proper API keys, in theory I could programmatically poll the system for new notifications and process them, sending each to each users specified (if one is specified) account along with the post URL, title, other such information.

Sorry if it seems like I want to reinvent the wheel, but I’ve honestly found it fun playing with the API a bit, but the docs don’t seem to specify some things, which made me curious. Any code I produce I’ll slap on Github so that it can be view easily by anyone.

2 Likes

Well, I actually did it. This strikes it has an inefficient way to get this done, as I’m sure an easier way would be to work this out as a plugin for the forum itself, but I don’t know how to do that (yet) and thus, here it is.

https://github.com/dwhagar/discourse-tools/blob/master/discourse-notifier.py

The code is a bit sloppy, uncommented, and unrefined. It pulls settings off of a json file, which I have to make an example version of yet, but I’ll be getting to that before too long. However, it gets a list of all users from Discourse, and counts on 2 custom user fields one for the Pushover User Key and the other for the Pushover Application Key. If a user has both of those configured, it will then search for new notifications for that users. It keeps track itself of what notifications it has sent out using the notification ID. It also stores the pushover response for each users’s last push notification in a log file.

Since every time it runs it has to go though all the forum users, I can completely see this breaking down on larger forums, and perhaps would do better having a function to cache user data and only update API keys once every like hour or half hour or something, since that information could be relatively static.

Again, would probably be far better to just turn this into a plugin, but I’m not sure how. Ideally one would have it pull a list of people who need to be notified directly out of the forum on a new posting event, but I don’t know how to do that either.

1 Like

I recently published a plugin for pushover. Other push services could probably be added with not too much difficulty:

6 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.