Have a look at the alert package documentation https://github.com/jwiegley/alert. A basic setup for the alerting system is shown there.