Product articles DLM Dashboard
How to get Slack alerts when your…

How to get Slack alerts when your database schemas change with Slack and DLM Dashboard

Slack1Setting the scene

In my last post, I explained how it’s possible to integrate DLM Dashboard with just about every service you use at work. Now that’s all very good in principal, but how do you actually go about configuring DLM Dashboard to trigger an automated task in another app or service? In this post, I’ll show how you by connecting DLM Dashboard to Slack in order to send team IM alerts when unexpected database changes occur.

Why Slack?

While DLM Dashboard’s email notifications are really versatile, if you’re anything like me, you don’t necessarily spend all day in your inbox. At Redgate, we’ve been using Slack for a while now and it’s become invaluable. Slack is a team collaboration tool which is rapidly being adopted by pretty much everyone, everywhere. It’s a fantastic way of working with your team without getting bogged down in emails. There’s also the added advantage that it’s really easy to have a follow-up conversation with your colleagues alongside the alert, which would be really cumbersome via email.

Slack2

I’m going to show you how to set up DLM Dashboard database drift alerts in Slack using Zapier, an integration web service. As an alternative you could use IFFT, but I’m using Zapier because it’s worked really well for us on previous projects.

Set up DLM Dashboard email notifications

Before you get started, make sure you have DLM Dashboard set up and you’ve configured email notifications. We won’t be replacing email notifications, but using Slack notifications to compliment them. In fact, I’ll use the existing email notification setup to pass notifications to Slack.

If you haven’t already set up email notifications, take a look at the setting up email notifications documentation.

Create a slack channel for your notifications

I’m going to assume that you’re already using Slack. If you’re not, it’s really easy to get started. Once you’re up and running, launch Slack and create a new channel for your notifications. You can name the channel anything you like – I opted for #dlm-dashboard-alerts.

Create a Zap

As I mentioned earlier, we’ll be using Zapier to connect DLM Dashboard and Slack. Head over to Zapier and create an account. The next step is to create a new Zap which receives inbound emails and, in turn, triggers an action within Slack.

Select ‘Email’ and ‘New Inbound Email’ from the dropdowns on the left. On the right side select ‘Slack’ and ‘Send New Message’.

Slack3

Connect your Slack account to Zapier

This step is pretty straightforward – simply follow Zapier’s instructions to connect your Slack account (you may be prompted to enter your username and password). Once you’re connected, we can begin setting up email triggers.

Slack4

Set up email triggers

In order to send email notifications to Zapier, you’ll need to set up a Zapier email address. To do this, pick an email address (it can be whatever you like) and enter it into the email address field. I opted for dlmdashboardalerts. Once you’ve done this, click ‘Copy to clipboard’ and head over to the DLM Dashboard web interface.

Slack5

In the DLM Dashboard web interface, click the notifications tab and paste the new email address into the ‘send emails to’ field. If you already have an email address in this form you can separate the addresses with a semi colon.

Once that’s done, scroll down to the bottom of the page, re-enter your password (you need to do this every time you change email notification settings) and click ‘Save’.

Slack6

Configure your notifications in Zapier

To configure how the notifications appear in Slack, you need to return to Zapier and complete ‘Step 5’.

Slack7a

At this point, it’s possible to personalize and edit exactly what appears in your Slack notifications. You could, for example, use the subject of the Dashboard notification email in the message. This provides you with information such as the database name and the type of change which has been detected.

I’ve listed the fields you need to complete below:

  • Channel – The channel you’ve created in Slack – in this example I’ve used #dlm-dashboard
  • Text – The message you’ll see in Slack. You can customize to your heart’s content – for example, you can choose to include the email subject and also link to your DLM Dashboard instance.
  • Username – Who the message will appear to be from in Slack – I opted for Redgate DLM Dashboard
  • Icon URL – The avatar which will appear alongside your Dashboard notifications. You can use any image, but I’ve uploaded a DLM Dashboard icon to save you some time

That’s everything you need to configure. If you’re unsure of anything, here’s a screenshot of what the completed form should look like:

Slack8

And here’s a screenshot of what it will look like in Slack:

DLM-Dashboard-slack-together

Wrapping things up

You’re almost done, but before saving it’s a good idea to run a quick test to make sure everything is working. To do this, send an email to the Zapier email address you created and then click ‘test email trigger’.

Once you’ve verified it works, pick a name (such as DLM Dashboard Slack Notifications) and then turn on the Zap. You should now be set up to receive database drift notifications in Slack!

If you’ve found had any problems following any of the steps above, I’ve created a short walkthrough video to accompany this blog post:

Enjoy your DLM Dashboard Slack notifications!

DLM Dashboard
is Redgate’s new free tool for helping DBAs and developers know what database schema is deployed where. If you want to find out more, download the free edition!

Tools in this post

DLM Dashboard

Be the first to know when any of your database schemas change

Find out more