Notification is a feature for users who want to be informed about Content changes in the system. Users can subscribe to notifications on possible changes to Content items. Notifications are email messages sent to the subsriber’s address.
These Content changes can be any kind of change like making a new Content, editing, deleting, renaming, copying or moving an existing Content. The subscriber will receive emails about these Content changes. For these emails custom templates can be set that may contain dynamic parameters, filled with content field values.
Subscribers can edit their own subscriptions, but do not have access to others’. Only user administrators can view, edit, delete, activate or deactive notifications for the users they have access to (see details below).
Notification is turned on by default. To turn off this feature you have to disable it in the application configuration file. For details, see the Configuration section below.
Users will be able to subscribe only if they have an email address in the system. If their email address changes, all their notifications will be sent to their new email address from than on.
Notifications can be set up for any Content in the system easily in any list or library or in Content Explorer. You have to click the dropdown action menu on a Content to get the list of avalaible actions and select the ‘‘Set Notification’’ action. You also have access to workspace notification settings in the top right corner of your workspace dashboard (Workspace actions menu).
To see all the Notifications for a user, you have to use the user’s Notification admin action, accessible in Content Explorer on any user content - if you have admin privileges for that user. You should see something like this:
The Edit link leads you to the notification edit page where you can see and even change the details (frequency, language) - or switch on notifications temporarily by inactivating the subscription.
A user can not have more than one notification for the same content. Notifications are bound to content paths in the repository. That means if the content path is changed (e.g. the content was moved), all the notifications related to that content will become invalid.
In the list view you can even delete notifications by clicking on the ‘‘Delete’’ button. The notification will be deleted at the background, the user won’t be notified about this event.
This feature requires a mail server to be cofigured in web.config. Please make sure that you added this fragment filled with the address and optionally access credentials to your mail server.
<system.net> <mailSettings> <smtp deliveryMethod="Network"> <network host="mail.example.com" defaultCredentials="true" /> </smtp> </mailSettings> </system.net>
Notification configuration is placed in the “sensenet/notification” section of the web.config. The section definition is:
<section name="notification" type="System.Configuration.NameValueFileSectionHandler"/>
There is a master switch for the notification feature. Default is “on” - meaning notification is enabled, events are collected and mails are sent. Deactivate the feature with this line:
<sensenet> <notification> <add key="MasterSwitch" value="off"/> </notification> </sensenet>
The notifications are sent periodically in one email per subscription or per user. Events’ descriptions in the monitored periods are aggregated in one email. There are four configurable time frequencies. Every frequency can be switched off using the “Never” keyword.
If the user is subscribed to several different content (e.g. a couple of workspaces), emails may be sent per subscription or aggregated into one email per user. This depends on the following configuration setting:
<add key="GroupNotificationsByUser" value="true"/>
By default grouping notifications by user is enabled.
Instant emailing is done only in certain intervals to avoid performance degradation. We recommend that the notification’s heartbeat should be a couple of minutes (2-10). The default setting is 5.
<add key="TimerInterval" value="5"/>
The “Never” keyword can be used to switch off instant mailing. If the instant notification is needed, simply delete or comment out this line in configuration:
<add key="Immediately" value="Never"/>
The setting is the time of starting daily event collecting and sending mails. Valid value is: ‘‘[minutes][:][seconds]’’. For example:
<add key="Daily" value="01:00"/>
The setting consists of two terms: a day of week and a time: ‘‘[DayOfWeek][space][Time]’’. Day of week is one of the followings: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday. Time setting is the same as in the “Daily” case. Example:
<add key="Weekly" value="Monday 01:00"/>
This period can be configured in three different ways.
<add key="Monthly" value="Every 1, 01:00"/>
<add key="Monthly" value="1st Sunday 01:00"/>
<add key="Monthly" value="Last Sunday 01:00"/>
If you installed the system on a low-resource environment but still want to use notifications, consider the following:
Under the notification section you will find five settings regarding to the notification sender componenet of the system:
<add key="NotificationSenderAddress" value="email@example.com"/> <add key="RetryCount" value="3"/> <add key="RetryDelay" value="2000"/> <add key="TakeCount" value="20"/> <add key="MessageEncoding" value="utf-8"/>
Notification messages are emails that are constructed based on templates in string resources. To modify these messages you should navigate to the /Root/Localization folder in the repository and edit the MessageTemplateResources.xml resource file. Templates are multilingual and can be customized according to your needs.
This section lists the available template variables you can customize for different sections and frequencies.
You can customize the email subject for every frequency mode by changing the value of the following resource keys:
A list of header templates, placed at the beginning of the mail body:
A list of content change templates:
A list of footer templates:
You can use the following keywords inside the templates. They will be replaced with proper values.
Besides changing the built-in configurations and templates it is possible to further customize the notification messages and control the notification process using Notification Configs. Please read the following article to learn more:
Is something missing? See something that needs fixing? Propose a change here.