Use the Jenkins bot in Google Chat to get notifications about your Jenkins builds.
Before you begin
- You need permission from your G Suite administrator to install bots.
- You need to add the bot to Chat.
Learn how to Find bots and add them to Chat.
Step 1: Install Chat plugin on Jenkins server
You must sign in as a Jenkins administrator to do this task.
- Download the Chat Notifier Plugin file.
- In Jenkins, go to Manage JenkinsManage Plugins.
- On the Advanced tab, under Upload Plugin, select the downloaded plug-in file from step 1 and click Upload.
People in your organization can now install and set up the Jenkins bot.
Step 2: Set up the Jenkins bot in Chat
Jenkins needs the token that the bot generates to send build notifications to Chat. Each room that you add the bot to gets a token. The bot sends notifications to all rooms where it's a member.
- Open Chat.
- Open a direct message with the bot or go to a room with the bot.
- Copy the token displayed by the bot.
- (Optional) To display the token again, choose an option:
- In a direct message, enter token.
- In a room, enter @Jenkins token.
- (Optional) To regenerate the token, click Regenerate Token.
Step 3: Set up notifications
Get notifications for a build
- Open Jenkins.
- Go to the build that you want to add Chat notifications for.
- Under Build, next to Add build step, click the Down arrow and choose what to get notifications for, such as the build result.
- Under Post-build Actions, next to Add post-build actions, click the Down arrow and select Notify Hangouts Chat.
- Choose one of the following options and paste the token that you copied from Chat.
- Chat—Choose a global configuration that you previously set up.
- Chat Token—Override the global configuration for a specific Chat room.
- Check the boxes for the items that you want to get notifications about in Chat.
- Click Save.
You get notifications in Chat about build events, such as start, failure, and success. From a notification, you can click:
- Open Build—Modify the build configuration in Jenkins.
- View Details—View information about the notification.
Get notifications for a pipeline
- Open Jenkins.
- Open the pipeline that you want to add Chat notifications for.
- In your pipeline script, enter:
hangoutsNotify message: "This message is from a pipeline!",token: "your_jenkins_token",threadByJob: false
Note: In the above text, replace your_jenkins_token with the token that you copied above. You can set threadByJob to true or false.
- Click Save.
Using the bot in rooms
To use the bot in rooms, you need to explicitly @mention the bot in each message to the bot (including in replies to messages from the bot). The @mention confirms you're sending the message to the bot and not to others in the room.
Google, G Suite, and related marks and logos are trademarks of Google LLC. All other company and product names are trademarks of the companies with which they are associated.