Alert rules
Alert rules specify who should be alerted how and when, in case an event is created. Alert rules are configured per asset and per event type.
Setting up alert rules
For the best user experience, we strongly recommend you provide your users with an interface in your application where they can set up alert rules for their assets. This way, users can stay within the confines of your application with a user interface they recognize and are familiar with. The Notifense APIs can be used to provide the data and operations to support your user interface.
If you are, for any reason, unable to modify your application in this way, Notifense also provides its own alert rules portal. Call the GET /v1/assets/{assetId}/alertRules/portalLink API endpoint to retrieve a secure URL to our alert rules portal for a specific asset. This link is valid for 2 hours after retrieving it. Your application can redirect the user to this URL to configure the alert rules for an asset.
Who
Every alert rule must have a recipient. A recipient is a phone number, a culture and a time zone. The phone number is used to identify the person or business that resolved the event, and, when an event is escalated, to reach the recipient by the recovery specialist who processes the escalation. The culture (a locale identifier like nl-NL) and time zone (an IANA time zone name like Europe/Amsterdam) are used to correctly calculate local dates and times and to format and translate messages for the recipient.
How
An alert rule must have a channel. A channel is a means of contacting a recipient. For example, this can be a phone call, an SMS message or a Telegram message. For phone calls and SMS messages, the phone number in the recipient object is used. For other channels, the specific channel options object may contain properties that define how the recipient can be reached (e.g. the Telegram channel configuration object contains the chatId property, which is a Telegram chat ID).
When creating alert rules, you must specify the desired channel type and the corresponding channel options object.
When
Alert rules are in an ordered list. They are processed from first to last. If a recipient resolves the event, rule processing stops and the event will contain information about which recipient resolved it.
In addition, alert rules can have filters that limit when the rule should be processed. If the rule is filtered, it is skipped and processing continues with the next rule. The following filters are available:
| Name | Description |
|---|---|
isDisabled |
If set to true, disables this alert rule. |
daysOfWeek |
If set, the alert rule is only active on the specified days of the week. |
timeOfDay |
If set, the alert rule is only active between the from and to times of day. The time range may span midnight (e.g. from 22:00 to 06:00) |
dates |
If set, the alert rule is only active between the specified from and to dates. |
insideGeofences |
If set, the alert rule is only active if the asset is inside one of the specified geofence IDs. |
outsideGeofences |
If set, the alert rule is only active if the asset is outside all of the specified geofence IDs. |