Introduction

When working in teams, it’s important to know instantly when something changes in the codebase. Whether it’s a new commit, a merge request, or a pipeline status, getting alerts in team chat helps everyone stay updated.
In this guide, we’ll walk through how to connect GitLab with Mattermost using webhooks so that GitLab alerts automatically show up in your Mattermost channel.

Prerequisites

  1. A GitLab project or group where you want to send alerts from.
  2. Access to a Mattermost server with permission to create integrations.
  3. A Mattermost channel where notifications should be posted.
  4. Basic understanding of GitLab project/group settings

Implementation

Step 1: Create an Incoming Webhook in Mattermost

  • Log in to your Mattermost server.
  • Go to Main Menu → Integrations → Incoming Webhooks.
  • Click Add Incoming Webhook.
  • Choose the channel where you want GitLab alerts to appear (or select “any channel” if you want to specify later).
  • Give the webhook a descriptive name, for example: GitLab-alerts.
  • (Optional) Add a Profile Picture URL to show a GitLab logo as the bot avatar.
  • Save the webhook. Copy the Webhook URL — you’ll need it in GitLab.

Step 2: Configure GitLab to Send Notifications

  • Go to your GitLab project (or group if you want to apply it to multiple projects).
  • Navigate to Settings → Integrations (or Webhooks).
  • In the Webhook URL field, paste the Mattermost webhook URL you copied earlier.
  • Select the events you want to be notified about, for example:
    • Push events (commits)
    • Merge request events
    • Pipeline events (success/failure)
    • Tag events
  • Click Add webhook or Save changes.
  • Use the Test button to send a test notification to Mattermost and confirm it works.

Step 3: Verify Notifications in Mattermost

  • Open the Mattermost channel you linked the webhook to.
  • You should see a test message from GitLab.
  • Now, whenever you push a commit, create a merge request, or trigger a pipeline, GitLab will send a notification to the Mattermost channel.

Conclusion

By setting up a webhook between GitLab and Mattermost, the team can stay up-to-date with project changes in real-time. This simple integration ensures that no commit, merge request, or pipeline failure goes unnoticed, making collaboration smoother and response times faster.

Leave a Reply