Notifications for specific users

Hi,

I am trying to send notifications to specific admin users only. So far I was only able to create notifications for a topic and any admin user that subscribed to that topic would receive the the notification.

Say I have users A, B, and C … I need to create a notification for one topic with specific data to user A and another notification with the same topic but different data to user C. A should only see his one notification, B should see none at all and C should again see only his specific notification.

How would I go about this, please?

Thank you!

Never mind, i figured it out. For future Googlers:

  • in the notification data pass along the ID of of security user you want to address
  • create your own NotificationService, make it extend preside.system.services.notifications.NotificationService
  • in the new service override the method createNotificationConsumers()
  • in this method user the notification data (actually the security user id) to filter the notification subscribers

Of course you need to look out for a few things, like, make sure that notifications that are not affected by this “addressing” issue, should still be handled in the standard way.

Cheers

Chris

Did you look at the “Notification settings” under the admin settings menu?

Each notification topic has options, one of which is to limit it to specific user groups. Either use an existing admin user group, or create one specially for this purpose:

Each member of the group receives that specific notification, right?

So, unless I misunderstand this, in my case that would mean creating a group for each individual user (roughly 20 users) and also create a separate notification for each user.

As soon as a new admin user is added, I’d need to create a new group and a new notification.

If a user is removed I either need to remove the corresponding notification or later re-assign it to another new user.

Doable, sure, but, not really a feasible solution. Again, unless I misunderstand this feature

Ah, I missed the bit about different content for different users. This just restricts which user can subscribe to and receive the notification.

Depending on your requirements, this may be enough:

B will not be able to subscribe to it if not in the group(s) specified, so no extra logic required there.

By adding logic to the full renderer for the notification topic, you could change what is shown based on the logged-in admin user, customising the content for the user viewing it (derived from the single set of data stored on the notification).
As long as the email notification is only generic and is only pointing the user to view the notification online, this should work.

Having said that, it might be useful for the notification rendering system to pass the ID of who the notification is for to each of the rendering methods, so the email could be customised too.

Hmmm… never thought of putting the logic in the renderer. Wouldn’t B still receive the notification in his feed, even if the renderer shows nothing for him?

B only sees notifications he is subscribed to. And if he’s not in the allowed group(s), he doesn’t get the option to subscribe…