Configure dynamic notifications using JSON file

Overview

As a Sitefinity Administrator, you now have the option to push dynamic notifications, which you have defined in a JSON file beforehand, to different user groups. This feature is helpful, for example, when you want to create an additional communication channel with the Sitefinity CMS users.

Once a day Sitefinity CMS executes a task called ExternalNotificationsRetrieverTask, which reads from the JSON file (if available) and delivers any new notifications defined in this file.
With this option, you have the flexibility of scheduling dynamic notifications - the system can deliver the notification on any specific date to different user groups, based on what you have defined inside the JSON file.

IMPORTANT: For this feature to work properly, you must store the JSON file on the file system under SitefinityWebApp\Sitefinity\Notifications folder and name it notifications.json.
In NLB setup, you must place this file on each node.

Define dynamic notifications

Following is an example how your notifications.json file can be structured for the purpose of pushing dynamic notifications:

Below is a description of the properties that you should set inside this file:

  • Id (required)
    When the system starts to read from the notifications.json file, it remembers the last delivered notification. Therefore, when you add new notifications, the system will only process and send the new ones. For this logic to work, Sitefinity CMS uses the unique Id of the file. If you want to reset the current notification, which the system remembers as the last one delivered and start from the beginning, you have to change the file Id. If this property is not set, the file will be invalid and no notifications will be processed.
  • StartDate (optional)
    If you set this property, the notifications will be delivered from this date on. If not defined, it will be automatically set to the project's initial setup date. The logic behind this property is to have a starting point, if you want to schedule notifications to be delivered on a specific date. StartDate is used in combination with the StartDateOffsetInDays property (described below). This date should be set in the format mm-dd-yyyy.
  • Notifications – array of notifications, each of which consists of the following properties:
    • Index (required) – you should set the index as integer. To ensure that the notifications are delivered, you should always increment the index upon adding new notifications.
    • Message (required) – this is the message, which will be displayed on the user interface.
    • Url (optional) – the URL that will open when the user clicks on the notification. It can be set as an absolute or relative URL. If not set, clicking will not navigate to any URL.
    • NotificationKey (optional) – used to define the notification icon. If not set, a default icon will be displayed.
      For information how to create custom notification icons using a NotificationKey, see Sitefinity GitHub repository » Custom system notification icon.
    • Category (optional) – the category of the notification is displayed on the user interface right under the notification message.
    • Group (optional) – determines to which group of users the notification must be delivered. You can choose between 3 supported user groups – Admins, NonAdmins, and All. If not set, All will be used by default.
    • StartDateOffsetInDays (optional) – used in combination with StartDate, which you define in the beginning of the file. You set an integer offset compared to the start date. For example, you have set the current date for StartDate and 2 for StartDateOffsetInDays. As a result, the notification will be delivered after 2 days. If this property is not set, the notification will be delivered instantly.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?