API for alerting

This is reliant on @f0o's alert system in pr #366