Link Gitlab and Microsoft Teams using connectors

Microsoft Teams

In application development, often multiple developers or a whole team is involved. And when multiple individuals are working on a same project, there are chances of miscommunication and code conflict. We often need to check and track on who’s checking on which part of code and what changes are being made. In my company, we use Microsoft Teams for communication and Gitlab for code repository. Link Gitlab and Microsoft teams using connectors and get notified about the changes on codebase would be a great tool for my internal project management.

In my previous company, we used Slack for team communication and Gitlab for code repository. We had used Slack Notifications Service to push notifications from Gitlab projects to Slack. So I was looking for similar solution with Gitlab and Microsoft Teams, where I get notified about the changes on our codebase. Here is how I did it.

Link Gitlab and Microsoft Teams

Gitlab and Microsoft teams link using connectors is quick and easy. We will first setup Microsoft Teams connector and then setup Gitlab Microsoft teams notification webhook

MS Teams setup

  1. Create new Team or find your existing Team
  2. Create new channel or may use existing channel if you have already have one
  3. Find “…” next to Team channel name and click on it
  4. Select Connectors under “…” menu
    • Microsoft Teams channel options
  5. Search for “Incoming Webhooks” and click on “Add” button next to it
    • Microsoft Teams connector
  6. Then click on “Add” button following window.
    • MS Teams add connector
    • As I’m working on Ubuntu Linux machine, the following Step 7 and 8 might not be needed on Teams for Windows or MAC
  7. Then again, click on “…” next to Team name and select “Connectors” from the menu
  8. Find “Incoming Webhooks” under Connector for your team and click on “Configure” button.
  9. Give a name for the connector, add an image if you want, then click on “Create” button.
    • Setup MS Teams connector
  10. Now, you should receive a notification in your Teams channel from the name you just gave to connector, to confirm your connector has been setup successfully.
  11. Then scroll down to URl field and copy it. We will use this webhook url in Gitlab.

Gitlab Setup

  1. Go to your project repo in Gitlab
  2. Go to Settings > Integrations
    • Gitlab Integrations
  3. Scroll down to find Microsoft teams notifications and click it
    • Microsoft Teams Notification integration in Gitlab
  4. Select all the checkboxes you wish to receive notification for and paste webhook url we copied from MS Teams to webhook field
    • Microsoft Teams notifications
  5. Check “Active” checkbox to enable integration
  6. Finally, save the changes

That’s it! You should now receive notification in your Teams channel when you check in or change files in project repository.