Integrating GitLab-CI with Slack Webhooks: A Step-by-Step Guide

Suraj Solanki
3 min readJul 8, 2024

--

When you ask someone for advice, it may seem straightforward, but it often becomes challenging when you try to implement it practically.

This is especially true for tasks involving APIs and integrations. Working with GitLab-CI is enjoyable, but integrating it with Slack notifications taught me a lot. Although GitLab’s Slack notifications service article covers most steps for integration, it doesn’t explain how to create Slack webhooks for integration with a Slack workspace, whether it’s a private or public channel.

This blog aims to fill that gap and guide you through configuring GitLab-CI with Slack notifications.

Let’s Begin!

Step 1: Create a New Slack App

  • Go to the Incoming webhooks for Slack URL and click on Create a New Slack App.
  • You will be redirected to your Slack page where you can find your Apps page.

Step 2: Sign Up for a Slack Account

  • If you don’t have a Slack account, sign up for one. If you already have an account, skip to Step 5.

Step 3: Sign In with Your Organization Email ID

  • Sign in with your organization email ID. After signing in, you will receive an authentication token via email.

Step 4: Fill in Your Authentication Token

  • Fill in the authentication token you received in the email (this may take 2 to 3 minutes).

Step 5: Select a Workspace

  • Select one workspace go back to the Incoming webhooks for Slack URL and click on Create a New Slack App.

Note: If you want to create a new workspace, click on Create Another Workspace.

Step 6: Create a New App

  • Click on Create New App and then select From Scratch.
  • Provide the App/Bot name and select the workspace you want the bot to be configured in. Click on Create App.

Step 7: Configure Incoming Webhooks

  • You will see the App name in the left corner and other integration details on the page.
  • Click on Incoming Webhooks for integration.
  • Activate Incoming Webhooks by turning it ON.
  • Click on Add New Webhooks to Workspace.

Step 8: Select a Channel for Integration

  • If you are not an admin of the workspace, request approval for adding webhooks.
  • Select the channel you want to integrate your app/bot with and click Allow.

Note: Ensure the channel is already created in your workspace.

Step 9: Copy the Webhook URL

  • You will receive a webhook URL. Congratulations, you did it!
  • Copy that URL for integration with GitLab or any other application for notification events.

Step 10: Integrate with GitLab

  • Open the Slack notifications service | GitLab URL to follow the steps for GitLab application integration.
  • On the Integration page, click on Slack notifications. If you want other integrations, choose the appropriate option.

Step 11: Configure Slack Notifications in GitLab

  • Enter your channel name (the one you selected during webhook creation).
  • In the Webhook field, paste the copied Webhook URL.
  • Click on Test settings to ensure the integration works correctly.
  • If the test is successful, click Save Changes.

Conclusion

By following these steps, you can successfully integrate GitLab-CI with Slack webhooks for seamless notifications. I hope this guide helps you avoid common pitfalls and makes your integration process smoother.

If you have any questions or feedback, feel free to leave a comment.

About The Author
Suraj Solanki
Senior DevOps Engineer
LinkedIn: https://www.linkedin.com/in/suraj-solanki
Topmate: https://topmate.io/suraj_solanki

--

--

Suraj Solanki
Suraj Solanki

Written by Suraj Solanki

Senior DevOps Engineer | Enthusiast of cloud & automation | Always learning & sharing insights | Connect me on https://www.linkedin.com/in/suraj-solanki

No responses yet