Notification Rules
Last updated
Last updated
With notification rules, you can perform custom notification sequences. Notification rules are processed after PagerTree has selected the account user to notify, but before default notification channels are used. The diagram below shows the high level workflow for alerts and how they move within the PagerTree system.
Notification rules are objects that can dynamically change a notification cycle.
Notification rules only apply to the Alert open message.
Notification rules must be attached to an account user to be used.
To access notification rules, you must enable "advanced mode".
Notification rules are evaluated in top down order.
If no rules are matched, the account user is notified on their default notification channels.
Notification rules are written in YAML.
The notification rules syntax is the same as routers.
The match block works exactly the same (data and operators are the same)
The actions block works exactly the same but with different actions.
Please see the routers documentation for rules syntax and match conditions.
Remember to come back here for notification rule specific action types.
notify - Notify the user on specific channels.
repeat - Repeat the notification cycle.
ignore - Suppress notifications from being sent.
The notify action will notify the account user on specified channels then wait for a timeout for next instructions.
Parameters
channels - array - any of the following: push, email, sms, voice, whatsapp, slack
channel_options - hash
email - string - primary, secondary, email address
email_fallback - boolean - fallback to primary email address if email parameter not found?
sms - string - primary, secondary, phone number (E.164 format)
sms_fallback - boolean - fallback to primary phone number if sms parameter not found?
voice - string - primary, secondary, phone number (E.164 format)
voice_fallback - boolean - fallback to primary phone number if voice parameter not found?
whatsapp - string - primary, secondary, phone number (E.164 format)
whatsapp_fallback - boolean - fallback to primary phone number if whatsapp parameter not found?
timeout - string - ms notation of the duration to wait before the next action.
The repeat action will repeat the above notify actions n times. You can repeat between 0 and 3 times.
Parameters
times - integer - the number of times to repeat the notification cycle.
The ignore action will suppress sending any notifications to the account user when matched.
When you are happy with your notification rule definition you must connect the Notification Rules to the User.
Navigate to the My Settings Page.
Scroll to the Other Settings section.
Select the notification rule definition from the Notification Rules select box.
Click Update.
Matches everything
Notify email, sms, slack (wait 1 minute)
Notify voice (wait 5 minutes)
Repeat the above cycle 1 more time
Match alerts with title containing "special title" (case insensitive)
Notify email, sms, slack (wait 1 minute)
Notify voice (wait 5 minutes)
Repeat the above cycle 1 more time
Match medium or low urgency alert outside of working hours
Ignore
Else, notify via default notification channels.
Matches everything
Notify primary voice (wait 1 minute)
Notify secondary voice, fallback to primary if secondary not found (wait 5 minutes)
Many times a customer has written the notification rule correctly but forgets to attach the notification rule to the user.
Don't forget to attach the notification rule to the user!
A common error when configuring notification rules is that the YAML is not formatted correctly (mostly always indentation). You can use the JSON2YAML tool to check your indentation.
Question | Answer |
---|---|
What happens if the escalation layer timeout is shorter than my entire notification rule cycle? | The notification rule cycle will stop after the escalation layer times out. It's possible that all notify actions are not reached because the escalation layer timing out. |
Broadcasts don't seem to be respecting my notification rules, why? | Notification rules are only applicable when being notified about an Alert. |