Skip to content

Using hume with Slack

Arturo Busleiman aka Buanzo edited this page Jun 27, 2020 · 2 revisions

Using slack with syslog is as boring as with remote-syslog, which is also enabled as easily as:

humeconfig --rsyslog udp://remote-syslog-server:514

But, let's see something more useful.

You might be familiar with Slack (similar to Discord and other group-chat-with-integrations offerings, including open source ones like Mattermost which I am pretty sure will try to support next).

In Slack, you have Workspaces. People can join them, for instance, you could have your company's devops team workspace in slack. You can create different chat channels for different projects, sub-teams. You can integrate 3rd party apps into your workspace to integrate slack with different other systems (want to see commit messages in a channel? you can do it. Those kinds of things).

Imagine if you could have a #hume-messages channel that receives... well, hume messages.

These are the steps:

  1. Create an app: https://api.slack.com/apps
  2. Create the #hume-messages channel (name it whatever you want).
  3. Add a Webhook to your App for the #hume-messages channel and take note of the Incoming Webhook URL.

Now that you have the webhook url:

sudo humeconfig --slack $WEBHOOK_URL    # replace $WEBHOOK_URL with the actual url
sudo systemctl restart humed

Presto, your hume messages will arrive in the designated channel!

But that can be noisy, so humed also supports level-based routing. That means you can have channels for messages that indicate a specific error level such as warning, error, critical or debug. All ok/info messages will go to the default channel, which you could mute.

For instance, create channels for error and critical levels, take a note of the webhook URLs, then:

sudo humeconfig --slack $WEBHOOK_URL --slack-error $ERROR_WEBHOOK_URL --slack-critical $CRITICAL_WEBHOOK_URL
sudo systemctl restart humed

The above configuration will route error and critical level messages to the corresponding slack channel. All other messages will to the default channel indicated with --slack.

The Slack API supports mentioning groups and users, so I will add humed/humeconfig functionality reflecting that. This way you could force a notification to appear at the hume command level.