Docs
WebsiteLoginFree Trial
  • Getting Started
    • OnCall Users
    • Team Admins
    • Account Admins
  • Architecture Guide
  • Common UI Design Patterns
  • Alerts
  • Teams
  • Schedules
  • Escalation Policies
  • Integrations
  • Broadcasts
  • Users
  • Notifications
  • Reports
  • Billing
  • Accounts
  • Stakeholders
  • Maintenance Windows
  • Routers
  • Notification Rules
  • Single Sign On (SSO)
  • Integration Guides
    • Introduction
    • 66uptime
    • Apex Ping
    • AppDynamics
    • Auvik
    • AWS CloudWatch
    • Azure Monitor
    • Cloudflare
    • Cronitor
    • Datadog
    • Dead Man's Snitch
    • Echoes HQ
    • ElastAlert
    • Email
    • Form
    • Freshdesk
    • Freshservice
    • Google Hangouts Chat
    • Grafana
    • Healthchecks.io
    • HetrixTools
    • Honeybadger
    • Hydrozen
    • Jira Server
    • JotForm
    • Kapacitor
    • LogicMonitor
    • Mattermost
      • Outgoing Webhook
      • Post to Channel
    • Meta Workplace
    • Microsoft Teams
    • New Relic
    • Outgoing Webhook
    • Pingdom
    • Prometheus
    • PRTG Network Monitor
    • Pulsetic
    • Sentry
    • ServerGuard24
    • Site24x7
    • Slack
      • Notifications
      • Outgoing Webhook
      • Post to Channel
    • SolarWinds
    • Stackdriver
    • StatusCake
    • Twilio
      • Incoming SMS
      • Live Call Routing
    • Typeform
    • Uptime
    • Uptime Kuma
    • UptimeRobot
    • Webhook
    • Zendesk
  • API
    • Introduction
    • Authentication
    • Errors
    • Pagination and Filters
    • Common Model Attributes
    • Account Users
    • Alerts
    • Broadcasts
    • Comments
    • Escalation Policies
    • Events
    • Integrations
    • Logs
    • Maintenance Windows
    • Notification Rules
    • Routers
    • Schedules
    • Teams
    • Users
  • Command Line Interface (CLI)
    • PagerTree CLI: Command Line Interface
Powered by GitBook
On this page
  • What are Notification Rules?
  • Notification Rules Video
  • Rules Syntax
  • Actions Block
  • Action Types
  • Putting It All Together
  • Attach the Notification Rules to your User
  • Examples
  • Example #1 Match Everything
  • Example #2 Special Alerts and Working Hours
  • Example #3 Primary Secondary Phone
  • Common Mistakes
  • Forgot to Attach to User
  • Bad Indentation
  • FAQs

Was this helpful?

Notification Rules

PreviousRoutersNextSingle Sign On (SSO)

Last updated 11 months ago

Was this helpful?

What are Notification Rules?

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.

High Level Alert Workflow (Notification Rules)

Notification Rules Video

Rules Syntax

  • 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.

Actions Block

Action Types

Notify

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_fallback - boolean - fallback to primary phone number if sms parameter not found?

    • voice_fallback - boolean - fallback to primary phone number if voice parameter not found?

    • whatsapp_fallback - boolean - fallback to primary phone number if whatsapp parameter not found?

- type: notify
  channels:
  - email
  - sms
  - voice
  - slack
  channel_options:
    sms: "secondary"
    sms_fallback: true
    voice: "+155555555555"
  timeout: 1m

Repeat

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.

- type: repeat
  times: 1

Ignore

The ignore action will suppress sending any notifications to the account user when matched.

- type: ignore

Putting It All Together

Attach the Notification Rules to your User

When you are happy with your notification rule definition you must connect the Notification Rules to the User.

  1. Scroll to the Other Settings section.

  2. Select the notification rule definition from the Notification Rules select box.

  3. Click Update.

Examples

Example #1 Match Everything

  • Matches everything

    1. Notify email, sms, slack (wait 1 minute)

    2. Notify voice (wait 5 minutes)

    3. Repeat the above cycle 1 more time

# Notify me via email, sms, & slack. 
# If the alert is still open after 1 minute, notify me via voice. 
# If the alert is still open 5 minutes later, repeat this cycle.
---
rules:
  - match:
      always: true
    actions:
    - type: notify
      channels:
      - email
      - sms
      - slack
      timeout: 1m
    - type: notify
      channels:
      - voice
      timeout: 5m
    - type: repeat
      times: 1

Example #2 Special Alerts and Working Hours

  • Match alerts with title containing "special title" (case insensitive)

    1. Notify email, sms, slack (wait 1 minute)

    2. Notify voice (wait 5 minutes)

    3. Repeat the above cycle 1 more time

  • Match medium or low urgency alert outside of working hours

    1. Ignore

  • Else, notify via default notification channels.

# match alerts with the title containing "special title" (case insensitive)
  # Notify me via email, sms, & slack. 
  # If the alert is still open after 1 minute, notify me via voice. 
  # If the alert is still open 5 minutes later, repeat this cycle.
# match alerts with urgency medium or low, and outside of working hours
  # do not notify me
# if none of the above match, notify my default channels (not written, implied)
---
rules:
  - match:
      alert.title:
        "$regex": "special title"
        "$options": "i"
    actions:
    - type: notify
      channels:
      - email
      - slack
      timeout: 1m
    - type: notify
      channels:
      - voice
      timeout: 5m
    - type: repeat
      times: 1

  # if the alert urgency is medium or low, and outside of working hours do not notify me
  - match:
      $and:
        - alert.urgency:
            "$in":
            - low
            - medium
        - $timeBetween:
            timeformat: 'hh:mm a'
            timezone: 'America/Los_Angeles'
            starttime: '05:00 pm'
            endtime: '08:00 am'
    actions:
    - type: ignore

Example #3 Primary Secondary Phone

Matches everything

  1. Notify primary voice (wait 1 minute)

  2. Notify secondary voice, fallback to primary if secondary not found (wait 5 minutes)

# Notify me via primary phone. 
# If the alert is still open after 1 minute, notify me via secondary phone. 
# Fallback to the primary phone number if the secondary is not found.
---
rules:
  - match:
      always: true
    actions:
    - type: notify
      channels:
      - voice
      timeout: 1m
    - type: notify
      channels:
      - voice
      channel_options:
        voice: "secondary"
        voice_fallback: true
      timeout: 5m

Common Mistakes

Forgot to Attach to User

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!

Bad Indentation

FAQs

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.

- Notify the user on specific channels.

- Repeat the notification cycle.

- Suppress notifications from being sent.

sms - string - primary, secondary, phone number

voice - string - primary, secondary, phone number

whatsapp - string - primary, secondary, phone number

timeout - string - notation of the duration to wait before the next action.

Navigate to the .

A common error when configuring notification rules is that the YAML is not formatted correctly (mostly always indentation). You can use the to check your indentation.

(E.164 format)
(E.164 format)
(E.164 format)
ms
My Settings Page
JSON2YAML tool
notify
repeat
ignore
high level alert workflow
Notification Rules Tutorial Video (v4)
Select the notification rule.
select the notification rule