Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • EV 36 posts 146 karma points
    Oct 31, 2019 @ 09:09
    EV
    0

    Using notificationService to send notification to the user from backend

    Hello everyone,

    As far as I can tell, the notificationsService can only be used after the user does something (like click on Save).

    Is it possible to use it to send notifications to the user when an event happens instead of after he does something?

    We're planning on implementing our custom chat in the backoffice (for the Users, not the Members), and would like to use the notifications service to send a notification to the user when he has received a new message. We want to do that so he can get a visual cue about the message, like he gets a visual cue after saving something for example.

    Furthermore, we would like to have this notification show up for him wherever he is in the backoffice, or rather regardless in which dashboard of whichever section he is working in.

    Is there any way we can implement this?

    If not, do you have any suggestions on how we can achieve this in another way?

  • EV 36 posts 146 karma points
    Oct 31, 2019 @ 14:11
    EV
    0

    Anyone? :)

  • Trevor Husseini 15 posts 106 karma points
    Feb 06, 2021 @ 03:35
    Trevor Husseini
    0

    Aloha EV,

    Based on my experience with Umbraco v7 and v8 (4+ years), I believe you're on the right track. It's not that you can only use the notification service when a user does something, it's that the notifications themselves have to be associated to a piece of content, specifically an instance of the ContentItemDisplay class. Knowing this, I would reserve the use of this service for the purposes of the user taking an action in the Backoffice.

    With that said, I would suggest looking into other frameworks for your custom chat. I've had some success using this library for relaying transactional information, however, my use-case was different. I integrated it into a custom dotnet Core application that entailed a lot of front-end development.

    I hope this helps! I know you've probably already solved the problem by now but I just happened to stumble upon this as I'm looking for related information for v8.

  • Richard Ockerby 14 posts 125 karma points MVP c-trib
    Apr 09, 2021 @ 13:11
    Richard Ockerby
    0

    If you're wanting some kind of notification sent back to the user without them directly interacting with something you should take a look into SignalR. Kevin Jump wrote a post a while back that covers how to do it (see https://our.umbraco.com/forum/using-umbraco-and-getting-started/101153-signalr-in-umbraco-8)

    We had a similar problem where we wanted something to run globally rather than in a particular area. The approach we took was to load in the angular module through the package.manifest, then dynamically load in the module / controller through JS (the example we based this on is here https://stackoverflow.com/questions/15250644/loading-an-angularjs-controller-dynamically).

    Once you have that nailed you can do what you want with the messages received (whether that's the Umbraco back office notifications or something of your own making).

    Hope that helps!

Please Sign in or register to post replies

Write your reply to:

Draft