Slack Notifications Filter

Slack Notifications Filter using webtask.io

An outline of our approach is as follows:

  1. Define a slack channel that is configured to send you notifications for all messages, the notification channel
  2. Define an outgoing webhook for a channel whose messages you wish to filter
  3. Define an incoming webhook to “repost” the message to the notification channel for which you want a notification
  4. On webtask.io

Nuts and Bolts Setup

It isn’t too bad; the written instructions are probably more effort to read than actually do.

Download Gist from GitHub for the webtask

Here is a simple webtask (in Javascript) that I created to do the filtering. There are a few things to configure.

  • define your filter rules
  • customize the “repost”

Initial Configuration in webtask.io

You’ll need to do some initial setup for the webtask and then add some details after the Slack configuration.

wt create name=slack-notification-filter path/to/webtask_from_gist.js
Webtask created

You can access your webtask at the following url:

https://webtask.it.auth0.com/api/run/rest-of-the-url

Slack Setup

Notifications Channel

slack_menu
slack_menu
slack_build_menu
slack_build_menu
slack_build
slack_build
slack_add_outgoing
slack_add_outgoing
slack_token
slack_token

Back to webtask.io: adding secrets

We are treating the Outgoing Webhook token and Incoming Webhook url as sensitive information. webtask.io allows you to specify secrets that it encrypts. It injects their values into the context of your webtask.

wt edit slack-notification-filter
webtask_secrets
webtask_secrets

Congratulations!

You are done.

Errata

If you configure multiple outgoing webhooks, you’ll either

justideas.io

justideas.io — startups, software development, and process — by Christian Sepulveda

Christian Sepulveda

Written by

espresso fanatic, coder (still), VP Engineering Bastille, …yeah, espresso comes first. https://www.linkedin.com/in/christiansepulveda/

justideas.io

justideas.io — startups, software development, and process — by Christian Sepulveda