How To Integrate TeamCity and Slack

TeamCity offers built-in integration with Slack. For example, the integration allows you to send Slack messages whenever a build starts, finishes, or fails.

In this tutorial, we’ll show you how to set up Slack integration in your TeamCity account.

To start, open up your build configuration and click on Edit configuration, then go to the Build Features section.

tutorials-img

Click on Add build feature and scroll down to the Notifications build feature. In addition to Slack, the Notifications build feature can also send out email notifications to users.

tutorials-img

After that, you’ll have to fill in some details and establish a connection between your TeamCity server and Slack. To do so, you’ll first need to click on the Parent project’s settings link.

tutorials-img

On the Slack side, you need to create an application with the specific rights that you can see in this window.

tutorials-img

You can then open your application homepage in Slack and scroll down. You’ll find the app credentials at the bottom.

tutorials-img

You’ll then need to copy the Client ID and Client Secret as well as Bot User OAuth Token into TeamCity.

tutorials-img

You can then test the connection. Slack will ask you what information exactly TeamCity should be able to access. Once you click Allow, the connection will be established. You can then click Save.

tutorials-img

Once you’ve established the connection with Slack, you can then choose the channel or person that you want to send Slack notifications to.

tutorials-img

You can also change the message format from Simple to Verbose and add more options, such as status text, branch name, and changes.

tutorials-img

TeamCity also allows you to add a branch filter if you’d like to get messages related only to a specific branch. You can also choose exactly which events should trigger a notification. For example, you might want to be notified about whether a build failed or succeeded, or when a build fails to start.

tutorials-img

Once you’ve selected the options that you like, click Save. You will now start receiving notifications when the conditions are met.

tutorials-img

That’s it! Check out our other tutorials to learn how to send build information to GitHub or integrate TeamCity with Jira.