THOUGHT:

Tavern Bot — Corporation Pop’s custom Slack app for those after work decisions.

Like most people in these remote-working times, Corporation Pop gets its money’s worth from Slack (we’re on the free plan…), but did you know you can write custom apps that can be added to Slack Channels?

It’s meant to be used for boring mundane things like ‘finance’ and ‘productivity apps’, but there are no rules that forbid apps in the ‘whimsical fun’ category, so we created… Tavern Bot! 

Pop Benefit:

We’re located in the heart of Manchester, surrounded by loads of great bars.

Pop’s Dilemma:

It’s hard to choose between all the great bars for work socials — analysis paralysis!

Pop’s Solution:

Build an all-powerful AI which calculates the best place to head for a pint.

Ok the AI bit might be a stretch, but it sounded like the basis of a handy tool which would also showcase some of our fullstack development skills. Challenge accepted!

We focussed on a few core features: creating a library of venues, randomly selecting a venue from the list, and rating venues that have been visited. These options were structured into a series of messages and modals which users could navigate through; creating a sense of interactive engagement with a semi-intelligent (pub-obsessed) robot. 

Welcome tavernbot

The user starts by summoning the ‘bot’ using an activation phrase (like a beer version of Candyman, if you will).

Tavernbot Welcome screen

This then triggers a welcome dashboard message, with links to the various key features within the app.

Tavernbot selection

Asking the app to choose a random venue will trigger a ‘decision algorithm’ (ahem, selecting something randomly from the list), with the choice displayed in a glorious ascii art banner.

Tavernbot map

If you don’t possess ‘The Knowledge’ of Manchester venues, you can use the location button to display a handy map in a pop-up modal, linked to the Google Maps API.

Rate tavernbot

There has been fierce debate as to whether the app’s decision is binding and must be obeyed, or whether do-overs are acceptable. But just in case the options to choose another venue or confirm the choice are provided, which trigger further message journeys such as a scheduled reminder to rate a venue after visiting. 

 

So far Tavern Bot has been a great success, with the nervous anticipation of its powers of augury adding to the fun of socialising with work colleagues.

 

How did we make this?

Slack has a neat SDK called Bolt available in several languages, including our go-to JavaScript. This includes a number of handy built-in features, such as reacting to messages posted in a channel and generating interactable elements such as buttons within messages. The application listens to events within channels and triggers sub-functions when messages meet certain conditions. 

The code for Slack apps doesn’t live within Slack itself — it must run on an external server, which is granted access to listen in on a channel. We chose to deploy our code to AWS, and make use of a serverless architecture. Permanent app data (such as the list of venues) is stored within an S3 bucket. The code itself runs in a Lambda function and is publicly accessible via API Gateway. Serverless Framework was used to configure and deploy all the AWS services. 

 

Do it yourself

If you use Slack for team communication, you may well find that custom apps are a cost-effective way of adding powerful, bespoke functionality to your business toolkit. You can find the source code and deployment instructions here:

https://github.com/stuart-p/Slack-TavernBot