(Last Updated On: January 28, 2019)

Are you looking for how to do GitLab and Slack integration?. I recently did a new setup of GitLab server to be used by the company for internal projects. After completing the setup, I looked at ways to get notifications for all GitLab project actions – Push, Merge requests, issues, notes e.t.c.

Since we use Slack as a primary communication channel, it was for a fact we had to do Slack and GitLab integration. In this guide, I’ll share with you the steps I used to setup GitLab and Slack Integration for notifications.

If you don’t have GitLab already installed, refer to our installation guides:

Install Gitlab CE on Ubuntu 18.04 / Debian 9

Install Gitlab CE on CentOS 7 / Fedora 29 / Fedora 28

After the installation, you might be interested in securing your GitLab Server with SSL Certificate. For those using FreeIPA for user authentication, integrating GitLab with FreeIPA is also viable.

How to configure GitLab and Slack Integration

Once you have both GitLab and Slack services working. Below are the steps you’ll follow to get the integration working.

  1. Create Slack Channel for GitLab project
  2. Get the Webhook URL for the channel
  3. Configure Webhook URL in GitLab Project.

Step 1: Create Slack Channel

Sign in to your Slack team and start a new Incoming WebHooks configuration. If you have Channel already created, choose it from the “Choose a channel” dropdown.

If you don’t have a Channel created, click the “create a new channel” link.

Fill Channel details, to be specific:

  • Select if Channel is Private or Public – This will likely be Private where you invite members to the channel.
  • Channel name
  • Purpose of the channel – Description
  • For Private channel, select list of guys to send invites to – This can be done later

When done, click on “Create Channel“. Confirm that the correct channel has been chosen then click Add Incoming WebHooks integration.

Copy the given Webhook URL and proceed to Step 2.

Step 2: Configure Webhook URL on GitLab

1.Login to your GitLab Dashboard and navigate to Project > Settings > Integrations.

2.Under the “Integrations” section, click on “Slack notifications” to activate it.

Check the Active checkbox to turn on the service.

3.Check the checkboxes corresponding to the GitLab events you want to send to Slack as a notification.

4.Paste the Webhook URL that you copied from the Slack Configuration step inside the Webhook box.

5. Click on “Test settings and save changes” to validate your settings.

If the configuration was successful, you should receive a test commit message in your Slack channel.

There you go!. You have successfully integrated your GitLab project and Slack channel to receive notifications for all repository events.