Maybe you’ve been lamenting the lack of robust chat functionality in TFS, or maybe you’re just already in love with the chat tools you have, and would love to have a way to make it a more integral part of your TFS experience. With the latest release of TFS, this is easier than you think! If you’ve been using VSO, or if you upgraded to 2015, you can do just that! Now while you can get super fancy and do some integration acrobatics programmatically, you can also do some quick integrations right through the TFS web UI. And I’m all about quick and easy integrations when I can get them.
In my case, I wanted to setup TFS and Slack so that I could receive important notifications from TFS right in my active chat window. It’s not hard, but there was quite a bit of bouncing around so I wanted to share the basic steps and hopefully lead you quickly down the right path to get it set up. So fire up your TFS instance and follow along, or just grab a cup of tea and take a peek at just how simple it is to get these two great tools talkin’.
Start right here in the TFS admin tools, in the Service Hooks tab:
When you add a new hook, there are actually quite a few options including Campfire, Jenkins, Slack, and a host of others.Once you select the service, just choose the event that you want to subscribe to, and specify any other filters or options based on the service event you are subscribing to.
Currently you can setup subscriptions for a number of events including:
code pushed (for Git team projects)
pull request create or updated (for Git team projects)
code checked in (TFVC team projects)
work item created, updated, or commented on
message posted to a team room
In this example, I am just keeping it simple and asking to be notified any time a new work item is created in the team project, at any level. I *could* have narrowed it by work item type, or even area path.
Next you’ll need to set up an Incoming WebHook for whatever tool you are looking to send messages to from TFS. In Slack, you would go to the Configure Integrations menu to start this process:
Assuming this is your first integration into Slack, you’d need to setup a channel to post to next. If you do have existing channels, you may select one of them assuming you don’t mind merging multiple streams of information.
Channels give you a way to tap into a feed of messages within Slack, rather than have information from many sources all jumbled up into a single flow of data. Since it’s super simple to switch between channels in Slack, I just created a separate one for this new stream.
Once you have your channel setup, add the incoming WebHooks integration by grabbing the URL that will be used to send the JSON payload to Slack, and paste it into the Service Hooks dialog back in TFS.
Make sure to hit the TEST button to ensure that everything is working as expected.
You should see a notification from Slack about the test message (if you’ve enabled notifications), as well as in the Slack channel feed. Rinse and repeat until you’ve setup all the types of integrations you want. It’s that easy!
Now whenever any of those configured events are triggered, you’ll get notified in Slack!
Hopefully that quick walkthrough gave you a good idea of the kinds of integrations you can setup between TFS and some other great automation and collaboration tools using just the TFS ServiceHooks available right in the TFS web console.
Have fun and happy integrating!