Desk Bot, a hot-desk solution built on Slack

The inside story of my most successful, half-thought-out weekend project

Illustration by Josh Cochran

What is a hot-desk? The concept of hot-desking is a desk organisation process that enables a single desk to have multiple occupants on a rota system or when required. Our implementation is more along the lines of ‘hotel desking’ in which an employee can ‘book’ a desk for a period of time rather than be assigned to it.

Why did we need a hot-desk solution? There are more people than desks in our Brighton office, but they are not all used every day. We needed to initiate a way of assigning working spaces/desks to enable employees to use the same desks at different times — plus, it saves space and costs.

“To ensure desk sharing worked efficiently we needed an easy way to communicate which desks were free and when. We wanted something that all IT employees who use the Brighton office could access and we also wanted a solution with little cost or overhead.”
– Antonia Clarke, PMO Director @ INTO University Partnerships.

‘Off-the-shelf’ options available in the market were considered too expensive. For a few weeks members of the IT team were invited to present and discuss possible solutions to the issue. Being a software engineer I leaned towards a digital solution. In this case, I presented the option of creating some form of custom Slack app that would be the central point of truth for free desks and would handle to process of a user claiming or releasing a desk.

This Slack bot would enable team members to ‘ask’ Slack which desks are available on which day; along with a series of other functionality allowing users to ‘free up’ their own desk to allow another user to ‘claim’ it.

For people to adopt a hot-desk solution, it needed to be simple, and it needed to be convenient. There’re many people in the office who have a desk that they are consistently at, and such they do not need to worry about finding a desk to sit at every morning. However, when they’re not in office, their desk becomes a very valuable entity to those who do not have a desk to be at.

(Enter Desk Bot)

I chose Slack as the host for Desk Bot as it meets all the needs for the users; it’s simple and convenient. Slack is part of the everyday tool box for employees, so getting people to use it wouldn’t be all too difficult. I set out over the course of a weekend to build a concept of Desk Bot.

Desk Bot was originally designed to be a Slack integration that would handle the process of claiming or releasing a desk. A user would register themselves to the Desk Bot and would also provide the desk number that they are assigned to. Users with no default desk would simply leave this blank.

I built the first proof of concept in Python, on Slack’s SlackClient SDK, however, the logic of Desk Bot soon became complicated; something I was keen to extract from the Python bot and into a separate service.

When Desk Bot V1 was initially released, it supported 4 commands.

Release a desk

Allows a user to release the desk that they are at for a period of time. A user can either type in a date time such as DD/MM/YYYY or today and tomorrow. This will then register their desk as ‘free’ for another occupant to claim.

As the target audience for Desk Bot varies in technical ‘know-how’ I’ve added plenty of error handling and validation. The error message below is an example error given to a user who has used an incorrect date format.

Claim a desk

Allows a user to claim a free desk for a period of time.

A user can claim a desk for a single day, or range of days by using the following syntax:

As with the above, the !claim command features plenty of error handling, below is an example of the error given to a user who puts in an invalid desk number.

Find all free desks on a date

Allows a user to see all free desks for a specific date; at first this displayed a comma separated list of desk numbers, however, it is now in development to generate a colour-coded floor plan of the office to show available desks and where they’re located.

Find the availability of a desk

Allows a user to check the availability of a particular desk on a set date.

After the initial proof of concept was built, I presented it to IT SMT and began to formulate a plan to roll it out. The presentation went well, there were a few questions as to the scalability and usability of the command line style structure but users didn’t seem to have too much of a problem with the introduction of the !commands command that gave a run down of each command and the accepted parameters.

The roll out began in the #desk-bot-test channel, where we trailed the bot with a series of users, including some of IT SMT and our testers, a few bugs were raised; and promptly squashed. After a week or two of user testing in the #desk-bot-test channel we were happy enough with the stability and usability of it to roll it out in production. At this time, we created the #desk-bot channel and left Desk Bot to do its thing. Initially all employees were invited to the channel, however, some chose to message the bot directly instead.

A Desk Bot for the future: introducing micro-service scalable architecture.

Within a matter of weeks, the vanilla Python bot outgrew itself; and as the demand for new features grew, so did Desk Bot’s architecture.

In the newest version of Desk Bot, I introduced a .NET web API, built in .NET Core 2.1. This would be responsible for handling the logic of desk functionality, and database connections / CRUD operations. It is to serve as the ‘single point of truth’ for desk availability. The Web API is secured via an implementation of JWT authorisation.

The Python SlackClient implementation of Desk Bot still remains, however, it is now responsible for formatting HTTP requests to the web API and handling responses to pass onto the user; this includes managing token’s for the Web API’s authorisation.

What’s next?

The bot now requires a series of new commands and functionality, these include:

● Administration commands to allow line managers to forcibly ‘free up’ desks of their employees who’d perhaps forgotten to do so.

● A new interface for input and output to increase the usability of Desk Bot, this includes changing the interaction with Desk Bot to buttons and drop downs.

I plan to use Microsoft’s Identity Model Claim principle to achieve the required administration commands. This will be managed by the Web API and tied in with the JWT token-based authentication for handling on the python bot.

The new interface will be based on Slack’s Block Kit, a new UI framework that will allow for a completely revamped view to Desk Bot and how it presents information and options to its users. Something I am very keen to get a chance to implement upon its release.

There are a few areas that I’d like to see Block Kit implemented, one of those being the error messages, with the ability to have more control of how data is displayed I think I’ll be able to introduce more helpful error messages. These new error messages could include an overview of the error, a list of possible solutions and section to cover how to get further assistance.

Another area in which Block Kit could improve the UX of Desk Bot is the process of claiming or even releasing a desk. Instead of a user having to type in a desk number and a date, a user could simply type in !claim and Desk Bot would present a drop down, with the options to select a desk number, a drop down so they can pick a date / date range and finally a submit button. The same goes for the !release command; the user could be presented with a date picker to choose the date(s) in which their desk is to be free, and click submit. Using Block Kit’s layout features will enable me to perhaps have a mini tutorial on the side to define how each field behaves to further clear any confusion.

Overall, Desk Bot takes its place as my most successful half-thought-out weekend project; I could not have anticipated it to be anything more than its first release, let alone see it become an adopted application by the company and scaled to what it is today. It has been an exciting learning experience and I look forward to seeing the future requirements of Desk Bot, how they’re implemented and any further issues that can be mitigated with Slack integration.

Ready to learn more about building your own app? Join Slack at Frontiers and get hands-on experience with the entire app development process.