Integrating Jenkins with Slack and Email Notification

Monday, January 27, 2020

Integrating Jenkins with Slack and Email Notification



Continuous Integration is a process in which all the development work will be integration as early as possible. The resulting artefacts are automatically created and tested. In this blog will help you the continues integration Jenkins with Slack and Email Notification, In order to notify developer each and every build on the slack channel and also if any build failed you will be notified in your mail.

Jenkins CI With Slack And Email Notification
Jenkins CI With Slack And Email Notification

1. Introduction


    Jenkins is an open-source continuous integration software tool which is written in Java for testing & reporting the isolated changes in larger code basis in real-time project. This is the software that enable developer to find the defects and solve it rapidly via automation testing. 

2. Create Slack Account

      Well Slack is charting software. Slack has provides a hooks, which helps to provide communication to your team members. Here are integrating Jenkins, so it can sends all the latest build notification into your slack Channel. So, If you haven't created your slack account till now, You can visit the below link - 

https://slack.com/signin?redir=/apps/manage

Or Channel Administrator - > Manage Apps - > Create Incoming webhooks


Once you have created a account, Please go Slack -> Administrator - > ManageApps

Slack Manage Apps
Slack Manage Apps


Search for Incoming WebHooks - 

Search For Incoming WebHooks
Search For Incoming WebHooks

Once you have done that. You will get the Below Screen - 

Incoming WebHooks
Incoming WebHooks

Once you have done that, please click on Add to Slack, You will get the below screen - 

Select-Channel-Name
Select Channel Name

Click on Add Incoming WebHook integration. You should get a slack webhook URL. Looks 

https://hooks.slack.com/services/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

You can also test the things from CURL Command - 

curl -X POST --data-urlencode "payload={\"channel\": \"#codeztech-jenkins\", \"username\": \"webhookbot\", \"text\": \"This is posted to #codeztech-jenkins and comes from a bot named webhookbot.\", \"icon_emoji\": \":ghost:\"}" https://hooks.slack.com/services/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

Details please check the below Screen Shot - 

Slack Webhook URL
Slack Webhook URL

3. Configure Slack Notification Plugin in Jenkins


   Make sure You have installed Slack Notification Plugin from Jenkins Manage Plugin. Please install the Lower version such as 2.20. If you don't know where to install version 2.2o plugin, please visit and download from the below link - 


Once you have done that, go to Manage Jenkins -> Upload This Plugin and Restart your Jenkins. I have made a complete video on that, I am attaching it in the below this blog. Feel free to comment on my Youtube channel or this blog, if you have any issue. 

Once you have done that, Go to Manage Jenkins - > Configure System. 

Your Base URL  will be always - https://hooks.slack.com/services/ 
Team SubDomain - Will be Your  - Channel Name -- You will get it from your URL path like 

Slack - Incoming WebHook Team Sub Domain
Slack - Incoming WebHook Team Sub Domain

Add the credential and provide your channel name adding to # . Like where you are planing to send all the build notification. Click on Test Connection in order to whether the current setup is working properly or not.

Configure Slack On Jenkins
Configure Slack On Jenkins

4. Configure Email Notification in Jenkins


     In order to configure email notification in Jenkins We need to follow the below steps - 

SMTP Server - smtp.gmail.com
Default Email - @gmail.com

Check on the SMTP Authentication
Username - youremailId
Password -

Dont put your gmail password. Google won't allow that. what you have to Dont

Step 1 - Login to your gmail -> Go to manage your account
Step 2 - Click on the security tab -> Singing in to Google
Step 3 - Click on App password -> Select the Device you want to generate the password
Step 4 - Generate password

After that copy password and paste it -

Check on the SMTP Authentication
Username - youremailId
Password -
Check on ssl
SMTP Port - 465
Reply to Address - your other gmail youremailId
Finally click on test


Details please check the below Screen Shot - 

Configure-Email-Notication-On-Jenkins
Configure Email Notification On Jenkins

More Details please check my below videos - 


3 comments :

Dwayne said...

Your work is truly appreciated. The material gives lots of innovative ideas which is beneficial to our knowledge. Bulk Mailing Services

Pooja Sharma said...
This comment has been removed by the author.
Unknown said...

can u make other tutorial how to get aproval email for deploy