Skip to main content

Notification service

The notification service manages self-notifications. It enables you to provide your users the option to register email notifications for themselves in your app. Notifications are triggered on events related to a resource your app presents.

Concepts

You need to know the following concepts to work with the notification service.

Self-notifications

Self-notifications are emails sent to a user, triggered by an event matching a DQL matcher expression. The notification service supports the same event trigger configuration options as the AutomationEngine for workflows.

A self-notification is defined via the notification service API and the notification template as static asset in your App. The default approach to register/unregister a self-notification is by using the NotifyButton the Strato design system offers. You can use the notifications-client sdk to customize the behavior to your needs.

The self-notification is defined by

  • A resource ID, that defines which resource the notification is about. Together with the notification type it allows to lookup the self-notification configuration.
  • The notification type, that allows to associate the notification template with the self-notification.
  • The trigger configuration, that defines on which events a notification shall be sent.
  • The notification template, that defines the subject and the body of the email being sent.

A self-notification is always implicitly associated with the user context of the related API request (the user who clicked the NotifyButton) and the app from where the self-notification create request originates.

Resource ID

Identifier of a resource that the notification is about (for example an app id for app update notifications, a workflow id for workflow change notifications, ...). Together with the notification type it can be used to lookup if there a self-notification for the user and app.

Notification type

The notification type is defined as string and enables to have more than one notification type per app and provide specific notification templates.

Notification template

The notification template defines the subject and content of the email to send. It's expected to be delivered as JSON file in the static asset folder of your app. The filename must follow the convention {notification_type}.notification-template.json.

To format the notification content markdown syntax is supported.

Subject and body may contain expressions to dynamically define the content by for example referencing attributes of the triggering event.

  • environment()
  • event()
  • now()
  • timedelta() These are the supported expressions, which are a subset of the AutomationEngine expressions. For details refer to the expression reference.

Notification template example

{
"subject": "New app version for {{ event()['details.app.name'] }} - {{ event()['details.app.version'] }}",
"content": "{{ event()['details.app.name'] }} was updated to version {{ event()['details.app.version'] }} in environment {{ environment().id }}. "
}

Properties available for event() depend on the events matching your notification trigger configuration.

Trigger configuration

The trigger configuration defines which events result in an email being sent to the user. For details of the trigger configuration object check out the notfication-client SDK and .

Notify button

The Strato design system offers a NotifyButton that allows to register and unregister a self-notification. For details take a look at the component documentation.

Limitations

  • The notification service limits the amount of emails being sent to a user to 30 emails per user/app and hour. There is an email being sent that tells the user about the imposed temporary limitation when being hit.
Still have questions?
Find answers in the Dynatrace Community