The Ultimate Manual for GitLab-Slack Integration

When you would like to receive information about changes in GitLab through Slack, you can set up an integration between the two apps. If your team is already using Slack, taking a bit of extra time to create this integration will pay dividends in productivity down the road. We’ll discuss the key components of creating a GitLab-Slack integration.

What Is a GitLab-Slack Integration Anyway?

Image of side-by-side GitLab and Slack logos

When you set up a GitLab-Slack integration, you will automatically receive real-time updates in Slack whenever something changes in your GitLab repositories. This keeps your team as up to date as possible about what is happening with GitLab and proposed coding changes.

You also may be able to issue a command in Slack that takes effect in GitLab through this integration.

You do not have to jump back and forth between GitLab and Slack to see the changes occurring. Additionally, by including messages about changes in GitLab in a Slack channel, all members of the channel will be able to see the notifications immediately. Everyone will always have the latest information.

How a GitLab-Slack Integration Works

With a GitLab-Slack integration, you can take advantage of the best features of both apps. You will receive real-time notifications in Slack that allow you to work as efficiently as possible by responding to issues in GitLab quickly. This enhances your efficiency.

What Is GitLab?

GitLab is a cloud-based repository that allows coders to store their Git coding projects. This is a DevOps platform that gives coders the ability to plan projects and develop source code. With GitLab, coders can keep segments of the code in a separate location from the main code until they are ready for a merger.

Git is a version control system that allows coders to keep track of any changes that occur to files and to projects. Teams can coordinate successfully when using Git, as it shows the project’s migration through time. 

Developers do not have to use GitLab to be able to make use of the Git version control system. However, GitLab simplifies the process of managing projects, especially from an administrative standpoint. GitLab makes the coders using Git more productive by reducing the amount of time required for product life cycles.

What Is Slack?

Slack is a messaging program designed to help team members work more efficiently by allowing them to communicate, collaborate, share files, and assign tasks. 

Team members can create channels in Slack that contain one to hundreds of members. Only those members of a particular channel can see the messages and shared files, which keeps team members focused on the information they need to know.

Slack is especially useful for remote teams that don’t have the opportunity to meet in person. Slack works across any device or computing platform, and it can run from either an app or through a web browser window. 

When you integrate Slack with other software packages your team is using, such as GitLab, it makes Slack even more useful for the teams.

How to Create the GitLab-Slack Integration

As long as you have accounts with both GitLab and Slack, you can create an integration between the two. You have a few options for managing the integration, including:

  • Making use of a third-party app to automatically create the integration
  • Installing the GitLab-Slack application
  • Using Slack slash commands
  • Using the Slack notifications service

The final three options in our list require you to configure a few different settings within both GitLab and Slack. This can be a challenging process for some users. To avoid having to go through these steps, some people turn to a third-party app that can handle the integration process for them. We’ll discuss some of the options for using third-party apps next before discussing the other options for creating the GitLab and Slack integration.

Example 1: How to Create the GitLab-Slack Integration With Third-Party Apps

Multiple third-party apps are able to support the integration between GitLab and Slack. We will focus on two of the more popular third-party apps for this process, Zapier and Automate.io.

Using the Zapier App

Zapier landing page for connecting GitLab and Slack

One third-party app that helps with setting up integrations is Zapier. The Zapier app works to create integrations between thousands of apps, and it will work to create the GitLab and Slack integration. Some of the tasks you can perform using the GitLab and Slack integration include:

  • Post new issues: When a new issue appears in GitLab, Zapier can create a message in Slack. With the instant message, team members then can take care of the issue as quickly as possible.
  • Post new merge requests: When someone creates, closes, or completes a merge request in GitLab, Zapier can generate a message for a specific channel in Slack. You can set up Zapier to generate the message immediately or to send it at a certain time in the future.
  • New commits: When someone generates a new code commit on a particular project in GitLab, Zapier can generate a Slack message.

Zapier has a subscription price associated with it, ranging from $19.99 per month to a few thousand dollars per month, based on the number of integration tasks your team needs to run per month. There’s also a free version that allows for up to 100 integration tasks per month.

Using the Automate.io App

Automate.io landing page for Gitlab and Slack integration

Another popular third-party app that can create integrations between hundreds of apps is Automate.io. By creating your GitLab-Slack integration using this third-party app, you can take advantage of multiple features. 

With Automate.io, you can create customized actions like a channel message or a direct message in Slack when certain triggers occur in GitLab, including:

  • Creating an issue
  • Updating an issue
  • Closing an issue
  • Creating a pull request
  • Creating a commit

You also can issue some commands in Slack that will create or update an issue in GitLab. 

Automate.io offers pricing starting at $9.99 per month, depending on the number of actions you are using and the number of team members involved. Smaller teams will receive better results from Automate.io than larger teams. A free version of Automate.io can handle up to 300 actions per month.

Example 2: How to Create the GitLab-Slack Integration With the GitLab-Slack Application

GitLab application in the Slack App directory

The easiest option for creating the integration between GitLab and Slack is making use of the GitLab-Slack application. Just click on the Add to Slack button on the GitLab-Slack app directory.

When you attempt to install this app, it will automatically walk you through the steps of selecting the GitLab project for which you want to create the integration and the channel in which the notifications should appear in Slack.

You also have the option of performing a manual configuration for the settings of the GitLab-Slack app. However, this step will not work if you do not have the proper level of administrative control in Slack, as you will not be able to install and configure the app.

As of this time, the GitLab-Slack application is only usable on GitLab.com, and it will not work for on-premises installations of GitLab. You will need to make use of Slack slash commands for an on-prem installation, as we’ll discuss in the next example. 

Example 3: How to Create the GitLab-Slack Integration With the Slack Slash Commands

Slack Slash Commands screen

You may have some situations where making use of the GitLab-Slack app is not appropriate. If so, you still can create an integration between the two and then use slash commands in Slack to see and track changes in GitLab through the Slack app. 

This method of using the GitLab-Slack integration will not automatically generate notifications from GitLab in the desired Slack channels. (The Slack notifications service option discussed in the next example can give you this capability.) Instead, you will need to issue a command in Slack to see the information you want from GitLab. 

Just type the slash command as a message inside your Slack channel, and Slack will pull the information from GitLab. Some of the slash commands you can use in Slack to pull data from GitLab include:

  • Create a new issue in GitLab: Enter the project name and issue new, followed by the title and description for an issue that you want to create.
  • Close an issue in GitLab: Enter the project name and issue close, followed by the identifying information for the issue in GitLab.
  • Search for issues in GitLab: Enter the project name and issue search, followed by the search term you want to use to see a list of all issues that match the search term.
  • Move issues to a new project in GitLab: Enter the project name and issue move, followed by the identification information for the issue and then the project where you want to move the issue.
  • Add a new comment for an issue in GitLab: Enter the project name and issue comment, followed by the identifying information and the comment to add.

Example 4: How to Create the GitLab-Slack Integration Using the Slack Notifications Service 

Slack notifications service in the Slack app directory

Through the Slack notifications service, you can set up triggers in GitLab that will generate an automatic message in your desired Slack channel. This alerts the entire team about the GitLab change in real time.

You will need to make use of Incoming Webhooks inside Slack to allow the connection between Slack and GitLab. (We’ll explain those steps in detail in the next section.) After setting up the Incoming Webhooks within Slack, you then can work inside GitLab to complete the configuration process. 

Some of the triggers that you can set up in GitLab to generate messages in Slack include:

  • Push: When someone issues a push command to a certain repository in GitLab, the notifications service can generate a message in Slack.
  • Issue: When someone creates, updates, or closes an issue (including a confidential issue) in GitLab, the notifications service can generate a message in Slack.
  • Merge request: When someone creates or updates a merge request in GitLab, it can generate a Slack message. Additionally, when the merge request completes, you can have the notifications service generate a Slack message.
  • Note: When someone adds a comment to the repository, you can choose to receive a Slack message.
  • Alerts and vulnerabilities: When an action in GitLab generates an alert or a vulnerability, the notifications service can create a message in Slack, giving you instant notification of the problem. 

How to Get Started With a GitLab-Slack Integration 

We will provide an explanation of the steps required to use the Slack notifications service to create the integration between Slack and GitLab.

Step 1: Sign in to Your Slack Account

Slack sign-in screen

Before you can enable an integration between GitLab and Slack, you will need to have a Slack account set up and ready to use. You can create a Slack account, or you can sign in to an existing Slack account

Step 2: Enable Incoming Webhooks in Slack

Create an App window in Slack API page

Once you have a Slack account ready to use, you’ll need to create an app in Slack. Visit the Slack API page and then click the Create an App button. 

The Create an App window should open automatically. (If not, you may need to click the Create an App button again on the next page.) Then click From Scratch to begin creating your app. Use the App Name text box to enter a name for the app. Then select the Slack workspace in which you want to create the app from the drop-down menu. Click the Create App button.

On the page that describes your new app, click the Incoming Webhooks button in the middle of the page. Then click and turn on the toggle button for Activate Incoming Webhooks. The Incoming Webhooks feature allows the posting of messages from external sources into Slack.

Step 3: Give the App Permission to Post in Slack

Example of permissions screen allowing you to cancel or allow GitLab Slack integration to have permission to access your Slack workspace

Scroll down lower on the page and click the Add New Webhook to Workspace button. Slack will open a new window where the app is asking for permission to access your Slack workspace. Select a channel from the drop-down menu for the app to use for posting messages. Then click the Allow button.

You’ll return to the settings window for the Webhook you just created. Scroll down the window to the Webhook URL section. Click the Copy button or leave the browser window open so you can copy this URL address later.

Step 4: Add the Slack Webhook to GitLab

GitLab screen with Webhook text box

Open your GitLab project. On the left side of the screen, click on Settings, followed by Integrations

Scroll down the window until you can click on the Slack Notifications link. Scroll through the Slack Notifications window’s options until you see the Webhook text box. Enter the URL address that you generated in the previous step in Slack. If you clicked the Copy button earlier, you should be able to paste the URL address into the Webhook text box. 

Scroll down and click the Test Settings button to send a notification to the linked Slack channel. If you set everything up correctly, you should see a test message in your Slack channel. Then click the Save Changes button in GitLab to complete the process.

Every company that uses Google Workspace should be using Nira.
Bryan Wise
Bryan Wise,
CIO of 6sense

Incredible companies use Nira