Skip to content Skip to footer

Insight

Cutting myself some Slack: how creating a bot streamlined my workload

by Dom Williams, 29 November 2017

Read Time: 5 minutes

At Redweb, we use a variety of different tools and services to ensure we’re working in the most efficient way possible. In my role as a Lead QA Analyst, I can be working across numerous projects with their own unique intricacies. Keeping track of all the discussions and details can be challenging, so I embarked on a project that would help make one of my most frequent tasks a little less cumbersome.

We use Slack, a cloud-based set of messaging and collaboration tools, to communicate within our team, as well as with other departments throughout Redweb. By using specific channels for projects, we can keep any discussions relating to them all in one place, which helps ensure everyone is in the loop.

We also use Visual Studio Team Services (VSTS) , a cloud service for collaborating on code development, within our team and with our clients. At any one time, there can be hundreds of different work items, from user stories to bugs, for a single project – so it’s impossible to remember them all.

When discussing a work item, like a bug for example, it can be difficult to recall the exact details. We may need to ask a question about it, referencing the item’s ID number to make it easier to identify.

So when someone asks “Does anyone know if bug #4750 is fixed?”, I have to leave the Slack channel, go to the project’s VSTS website, search for the bug number and view the details to remind myself what bug #4750 is.

A question posted in Slack

While this isn’t necessarily difficult, it’s quite inconvenient when doing it several times in a day. To help bridge this gap and make discussing work items easier, I decided to develop my own app to interact with VSTS using Slack’s slash commands.

Creating the bot

Wanting to learn more C#, I took the opportunity to create a bot that would both enhance my knowledge of the language and be useful for our team. I wrote the application in C# and hosted it using the Azure platform.

I then needed to make the app interact with Slack. Using a slash command in Slack’s message box can trigger an app to perform a function – for example, you can set a reminder in Slack by using the ‘/remind’ slash command.

Example of using a Slack slash command

So I created a new slash command in Slack using ‘/vsts’ as the trigger phrase and configured it to point to the URL of my application. When invoked, it sends data to my app, the app processes the data, and then returns a response.

When receiving a message, my app calls VSTS’s REST API to query information on a specific work item. The app then formats the work item data into a Slack response, picking out key fields, so it’s easily readable in the Slack channel.

As we use VSTS for lots of different projects, the command text needs to be followed by a project identifier parameter – usually two or three letters representing the project, such as ‘rw’ for Redweb. So, an example command for bug #4750 would be: ‘/vsts rw 4750’, which would return the following:

Information returned from the VSTS bot

This pulls through the title, assignee, iteration, state and severity, providing a helpful summary of the issue which slots straight into the Slack conversation. The title is also a link to the work item in VSTS, allowing you to click through and see more detailed information if needed.

Enhancing knowledge and productivity

We actively use this bot within our team and have found it’s helped us identify issues faster and streamline our conversations, which can only be a good thing when working on projects. Not only has creating the bot expanded my knowledge, but it’s also resulted in a tool that’s beneficial and user-friendly.

Not bad for something that started off as a way to help me learn more C# and better understand the Azure platform!

Sign up for our newsletter

Be the first to get insights from the digital world and the latest Redweb updates.

Thank you

By entering my details, I agree to the use and storage of my data as described in Redweb’s privacy policy.