plugin for getting user notifications?

Plugin Development
  • Hi, I'm new to NodeBB. Before I dive in and start writing my own plugin, I wanted to first ask if one already exists for what I need. I'm trying to get the the user's notification count and display it in our app next to a link to our nodebb forum. Is there a plugin that already does this that I can use? Thanks!

  • @Nick-Harmon Could be you don't need a plugin for something that simple... if the user is already logged in on the forum, then your app could really just GET /api/notifications to see the notifications.

    Of course, if they're not logged in then you'd just get an error.

    If you want to get their notification count if they're logged into your app but not on the forum, then it gets a little harder, because then you have to associate their NodeBB account with your app and make server-side calls, etc. etc... lmk if the simple solution helps.

  • @julian Thanks for getting back to me quickly. Other priorities pulled me away from this, but after looking at your response, it seems like what I'm actually after are "unread" counts, not just notifications. The simple GET solution returned notifications, but not every "unread". Our app is using the session sharing plugin, and we are associating NodeBB accounts with our app accounts. Would I be able to leverage some of the session sharing functionality to get an unread count for users on our app based on their NodeBB account? Thanks


Suggested Topics


  • 6 Votes
    3 Posts
    768 Views

    The hooks module has the same functionality as $(window).on() but it also allows having async filter hooks client side which was not possible with $(window).trigger/on

  • 0 Votes
    13 Posts
    6k Views

    Final update, it worked on the production server!! so now our forum is working properly sending emails the Linux way on a Windows Server OS, quite nice I would say, just as a side note our forum is actually really small in number of users, as it is an internal forum, so I can't assure this setup will work out to other forum's expectations or needs, also I would like to add that this shouldn't be the way to do it on Windows as it is kind of a weird way to handle it so in later versions it would be nice to see it reworked or polished for Windows environments (especially because it looks like the program used to simulate sendmail on Windows is no longer receiving maintenance).

  • 0 Votes
    2 Posts
    2k Views

    On the server, you can do

    var groups = require.main.require('./src/groups'); groups.getUserGroups([1] /*array of uids*/, function(err, userGroups){ if (err) return; // Returns an array of an array of group data. console.log(userGroups[0]); // Prints an array of groups for uid 1 });

    on the client, you can get a list of visible groups by doing:

    $.getJSON('/api/user/USERSLUG/groups', function (data) { // Returns an object with a 'groups' property, an array of visible group data. console.log(data.groups); });
  • 0 Votes
    1 Posts
    945 Views

    Hi! I'm trying to make another SSO plugin, but the difference is: i want user to fill missing fields (like email) after external authentication but before user is created in the forum.

    The only good solution i see is to override successReturnToOrRedirect andfailureRedirect fields to custom routes (https://github.com/NodeBB/NodeBB/blob/master/src/routes/authentication.js#L60), which are handled by plugin itself, to render input forms and logic. So i think it would be nice to extend login strategy with success/fail routes and use them if specified.

    I would like to hear opinion about my idea. If it is good enough i think i can create pull request.

  • 0 Votes
    13 Posts
    6k Views

    @ChaosYamYT This plugin is incompatible with current versions of NodeBB. You could try opening an issue at the Github repo for the plugin, and asking the developer to fix it.