Thoughts/questions about the new UserNotifcation and Subscription (epi 9.5)

Vote:
 

I have been playing around with the new UserNotification section described here -> http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/notifications/using-notifications/. I haven't used the old Subscriptions and so I can't take anything I have learned from Subscripions to the new UserNotfications. Now here are some thoughts I have

Using the INotificationProvider

If I want to use the Send() method I must provide a list of "ProviderNotificationMessage". The ProviderNotificationMessage class is a concrete class with only getters and no way to set the properties. How am I supposed to be able to send messages if I can't create any?

Why aren't any queued messages sent?

I can see in the tblNotificationMessage there are a lot of unsent messages but when I run the schedualed jobs the only information I get is "Status OK", "Total number of sent messages are 0.". Where can I see why they aren't sent? The only information I can get from the documentation is that messages that couldn't be handled correctly is put back in to the queue.

The Subscriptions part

How will this part work? From what I have seen in the Epi 6 and 7 documentation you need some special properties and pages. Is it still the same or do we have another approach here? From the documentation here -> http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/notifications/subscriptions/, I only know how to add or remove subscriptions but there is not much more about when subscriptions are sent and what else (if any) I have to do to make it work. In the scheduled job I only get "Status ok, 3 user profiles were found. 0 subscription e-mails were sent.". I have updated content on the page but still no emails.

I have some other thoughts about classes and interfaces that are internal but the above thoughts are my most headacing for now. I would really like to get som hints or comments about how to get this new Subscription and UserNotification working! Thanks!

(I understand this is still Beta and code changes between versions)

#143133
Jan 13, 2016 13:30
Vote:
 

Thanks for the feedback. I will try to answer some of your points.

  • This in not an API to replace the old subscriptions feature, bad naming from our part. It is just a very raw API to deal with notifications and storing subscriptions to arbitrary keys. We will update the SDK.
  • You are not supposed to call the provider directly, you just call INotifier and implement your own formatter, see code examples. The dispatcher scheduled job takes the messages and call the formatter and then passes on the formatted message to the provider. So ProviderNotificationMessage is only created by the dispatcher and not by any code using this feature.
  • Messages are not removed, they are just marked as sent so they can be queried from an UI. For example projects will show notifications in the UI in an upcoming versions. A scheduled jobs cleans the table (after 3 months or something).
  • A lot of logging exist if you don't think it behaves as it is supposed to, for example when it cannot find a matching provider etc etc. Especially the class EPiServer.Notification.DefaultNotificationDispatcher, enable debug logging for that class in your episerverlog.config.
  • Implementations are often internal and abstractions/interfaces are public, that is so that we can make changes to the implementations without forcing us into a CMS 10, or 11. Is there anything internal that should be public let us now and what you need to use it for. I logged a bug for ProviderNotificationMessage even though you would only deal with that class if you implemented your own provider (if you are not using e-mail).
#143478
Jan 25, 2016 14:52
Vote:
 

Thanks for the answer, I'll look into it and see if I get it to work now :)

#143481
Jan 25, 2016 15:49
Vote:
 

Per,

Thanks for the debugging tip. The reason the notification didn't work was because it couldn't find any formatter ->

2016-01-28 10:14:52,664 [78] WARN EPiServer.Notification.DefaultNotificationDispatcher: No Formatter found for Channel("epi.example")
2016-01-28 10:14:52,678 [78] WARN EPiServer.Notification.DefaultNotificationDispatcher: No Formatter found for Channel("Andreas kanal")

I added a formatter and it sent an email.

You should change this 

var notificationRepository = ServiceLocator.Current.GetInstance<INotificationRepository>();
INotificationUser receiver;
INotificationUser sender;
 
await notifier.PostNotificationAsync(new NotificationMessage()
{
        ChannelName = "epi.example",
        Content = "A page has been improved!",
        Subject = "Improvement",
        Recipients = new[] { receiver },
        Sender sender,
        TypeName = "PageChanged"
});

to

var notifier = ServiceLocator.Current.GetInstance<INotifier>();
INotificationUser receiver;
INotificationUser sender;
 
await notifier.PostNotificationAsync(new NotificationMessage()
{
        ChannelName = "epi.example",
        Content = "A page has been improved!",
        Subject = "Improvement",
        Recipients = new[] { receiver },
        Sender sender,
        TypeName = "PageChanged"
});

in this guide -> http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/notifications/code-examples/

Thanks for the help!

#143638
Jan 28, 2016 10:20
Vote:
 
<pre class="brush:html;auto-links:false;toolbar:false" contenteditable="false">Hi, I am new to EpiServer 9.. My new requirement is to create email subscription module. When users subscribes to the blog, all the subscribed users should receive email if any updates happens to that blog. I have no idea on how to proceed further .Can you please share all the steps to build the email subscription module ? If possible, can you please also share some working code ?</pre> <p></p>
#147574
Apr 19, 2016 5:04
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.