TeamCity Slack Notifier

Profile
Written by jason on March 4th, 2014

We love TeamCity here at Tapadoo. We use it to automatically build and deploy new iOS & Android app betas both internally for testing and to externally to clients. We’ve been using Slack lately as a replacement for Jabber and Mail for internal comms which don’t scale well, and its been awesome.

Slack has many cool integrations with other tools like bug trackers, Github, bitbucket and even some for CI servers like Travis, but none (yet) for our favourite, TeamCity. I liked the idea of automated posts arriving in the general channel as new betas went live. It could be a fun way to let everyone know progress was being made as the day went on. It’s easy to forget the little Mac Mini is playing an important role. Sure, developers would get their own personal success and fail messages via email if they wished, but unless you told someone, know one else had a sense of activity unless they loved checking out the TeamCity dashboard.

TeamCity has a plugin API apparently – Java based, and slack supports incoming webhooks allowing to to post anything you’d like, so with a little bit of free time between tasks, I decided to give it a go. I read some examples, hacked up a custom notifier class, zipped it up with some meta data, and a plugin was born:

Builds arriving in slack

Builds arriving in slack

 

Success! The messages started to trickle in. successes only, by design. Let the rest of the team feel happy some bugs where fixed. Just the name of the build, and who did it. I spared people the public humiliation of a failure (for now).

Sure, a few shortcuts were taken. I probably hard coded a few more strings and URLs than I should have. I may have used string concatenation instead of proper JSON classes to construct a payload, but it didn’t matter. Our little build server found its voice and started contributing to the teams banter.

It’s not without it’s flaws, please forgive the occasional naughty shortcut, but if you want to get in on the action we’ve stuck it up on Github : TCSlackNotifierPlugin , and of course, pull requests are welcome.

In the mean time, check out Slack. They even have a free plan with limited storage and integrations to get you properly hooked. I’m already scheming to see what other tools I can integrate.

 

current notification setup

current notification setup

 

Comments (4)

Yana says:

Hi, Jason!
I have a problem with TCSlackNotifier. I’am using TeamCity 8.1.4. When I load a plugin, it appears in plugins list, but did’n’t appear in My Settings & Tools. Maybe, this version of the server does not support this plugins UI?
Clarify please, what sort of token is using in main-config.xml? User’s token or token of integration ?

Thanks

Joel says:

Took a bit of work to get it running, but it works a charm on TeamCity 9.0.4.

Thanks for publishing this!

diana says:

I have the same issue with TCSlackNotifier. TeamCity 9.0.3. It appears in plugins list, but did’n’t appear in My Settings & Tools. I’ve been waiting for a couple of hours, but still didn’t see it shows up on My Settings & Tools. What else can I do or check?

Thanks

diana says:

the issue is resolved by using slack webhooks.

Comment on this post

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close