Integrating Error Notifications to Slack

Overview

App notifications will inform you about your application’s errors through a channel of your choice. In this example, we will create a Slack app and link it to an App Notification so that messages are posted to a Slack channel.

Pre-requisites:

Before starting the configuration, create an #app-errors channel to receive the error messages in Slack.

Creating a Slack App

To post messages from apps into Slack, a Slack App must be created with an Incoming Webhook. 

  1. Go to  https://api.slack.com/messaging/webhooks#getting_started and click on Create your Slack app and then choose to create it from scratch. A modal will show up prompting you to name your app and then pick the workspace you’ll be using. Then click on Create App.

C.png

  1. Turn Incoming Webhooks on.
organizing info
  1. Enter the Slack channel where notifications will be posted to.
organizing info
  1. Scroll to the button to find the Slack app URL. 

F.png

We recommend pasting the URL in the channel’s topic since it will be needed later on to create the App Notifier in the Console.

Adding the App Notifier to your Org

In the Console, go to Settings > Notifications and click on Create new.

organizing info

Choose a name for it, select Slack as Destination, paste the Slack app URL you have just created and click Create.

HH.png

A Send Test button will show up for you to click and receive a Test text on the #app-errors channel: 

I.png

Adding the App Notifier to your app

When publishing your app, click on Notifications and select the App Notifier you have previously created. Finally, click on Publish.

J.png

From now on, all error messages will be posted into the Slack #app-errors channel.