Slack Notifier

The Slack Notifier posts a message to a Slack channel. The message is a summary of the latest state of an alarm.

Message Format

The slack format is built to provide a Slack compatible message. By integrating with Slack, the alarm handler will produce nicely formatted alerts when an alarm is raised or cleared.

../../../_images/slack-alarm.png

Fig. 36 Slack message generated by alarm handler

Setup Slack

To enable alarms to be sent to the Slack channel, the following steps are needed.

  1. Visit the Slack API and create a new Slack app
../../../_images/slack-setup-1.png

Fig. 37 Create new Slack App

  1. Select the feature “Incoming Webhooks”
../../../_images/slack-setup-2.png

Fig. 38 Select Incoming Webhooks

  1. Activate incoming webhooks and select “Add New Webhook to Workspace”. Then select the channel you wish to post to
../../../_images/slack-setup-3.png

Fig. 39 Activate Incoming Webhooks

  1. Copy the new webhook URL which looks something like this https://hooks.slack.com/services/T123/B123/I123

This URL needs to be used when configuring the Curity Identity Server below.

  • hostname = hooks.slack.com
  • context = /services/T123/B123/I123

Configuration

To configure the Slack alarm handler, an HTTP client needs to be configured, along with the path, host and port to connect to. No authentication necessary on the HTTP client unless required by a proxy to communicate from a run-time node to Slack.

The slack alarm handler is configured under /environments/environment/alarms/alarm-handlers/alarm-handler

Parameter Description
slack-notifier/web-service/hostname Hostname for the slack api (hooks.slack.com)
slack-notifier/web-service/port Port of the web service (443)
slack-notifier/web-service/context The path on the web service to post to (/services/T123/B123/I123)
slack-notifier/web-service/http-client The configured HTTP client to use (under facilities)
Listing 13 A configured slack handler shown in the CLI
% show environments environment alarms alarm-handlers alarm-handler slack1
slack-notifier {
    web-service {
        hostname    hooks.slack.com;
        port        443;
        context     /services/T123/B123/I123;
        http-client trustStoreHttpClient;
    }
}