Receive Build Notifications on MS Teams using Jenkins

Jenkins is an open-source CI/CD tool that informs users about the success/failure/error status of their CI/CD pipeline. When a user triggers jobs through Jenkins, it shows the build status on the Jenkins dashboard by logging in.. In this blog post, we will discuss how we can use a centralized system where the build notification is sent when the build succeeds or fails. For this blog, our centralized system is going to Microsoft (MS) Teams. 

Configuring Jenkins with MS Teams: 

MS Teams: 

1. Select the MS Teams channel where you want to send the build notifications. 

image001

2. Configure the connector in Teams.

  • Configuration of “Incoming Webhook” app inside teams. 
    • Click the “Apps” button.

image003

    • On the Apps page, Search and select “Incoming Webhook.  

image005

    • Click the “Add to a Team” button. 

image007

    • On the “Add Incoming Webhook to a team” pop-up, search and select the channel in which you want to send build notifications. 

image009

    • After selecting the channel, click the “Set up a Connector” button. 
    • Copy and store the WebHook URL for later use and then click the “Done” button. 

image011

    • Now, provide the name of the Webhook and click the “Create button, you can also modify the icon avatar for it. 

image013

image015

    •  Once the webhook is created successfully, you will receive the alert message in the channel that the webhook is created successfully. 

image017

Jenkins: 

  1. Navigate to the Jenkins dashboard. 

image019

  1. Now we need to install the Office 365 Connector plugins within Jenkins.
  • Click the “Manage Jenkins” button.

image021

  • Now on the Manage Jenkins page, click the “Manage Plugins” button. 

image023

  • On the Plugin Manager page, search and install the “Office 365 Connector”

image025

2. After this, we need to integrate MS Teams webhook with the build pipeline. 

  • Open the desired build pipeline. 

image027

  • On the created build pipeline, click the “Configure” button. 

image029

  • On the configuration page, under “Office 365 Connector”, in the URL field, copy and paste the MS Teams Webhook URL and enter the desired name in the field. 

image031

  • Now click on Save to apply the configuration on the Build pipeline. 

 3. In this step, we will generate the build notification on MS Teams. 

Now when the build pipeline will run, it will generate a notification on MS Teams and will inform us about the build status.. 

  • If the build is a success, the following message will be displayed: 

image033

  • If the build is a failure, then the following message will be displayed: 

image035

Conclusion: 

You can easily configure Jenkins with Microsoft Team using the Incoming Webhook and the Office 365 Connector. Using the above-mentioned steps, you can select the channels in MS Team to send notifications from Jenkins when the build succeeds or fails. If you would like to know more about the process, feel free to reach out to us. We are happy to help.