BICA* - Best Instant Coffee Attendant

Thursday, 21 March 2019

Bica is a typical portuguese expression for a small cup of coffee.

It all began with a need to drink coffee! Over spring, every day, after having lunch in the galley, there was a widespread urge to drink coffee… without having to climb all the way up to the 3rd floor, where the coffee machine was in our old office.

Through some volunteering, or lot drawing, process, someone would climb the steps, bring back the coffee and happiness would ensue.

The first invention took the form of the “coffee-copter”, a cut-up cardboard box allowing the transportation of up to 6 coffees. The second part of the invention never actually took place: a notepad for the “volunteer” to write up the orders and not forget whether each coffee was with or without sugar. By the end of spring the system hand’t changed much, but the habit remained.

Eventually, during one of the lunches, someone blurted out: “It would be awesome if I could call up a cup of coffee without having to get off my chair.” We had just migrated to Slack and there was a lot of eagerness to fiddle with the integrations.

The idea took off: we decided to build a first version during creative day. The goal: to build a functional version of BICA in just one day.

On the day we launched BICA we didn’t say anything to the team! The first requests were born of curiosity and the simple “UX”, a tablet placed near the coffee machine. This was one of the funniest parts of the project.

Bica request

Social Effect

From the beginning, we imagined that BICA would have an amusing social effect. When you request a cup of coffee from BICA, you don’t know if it’s going to come and/or who is going to bring it. When it arrives, there is a fleeting moment of gratitude and happiness.

One of the most memorable moments starred Leo: he was stuck on a Skype call he couldn’t leave, praying for his first morning coffee. When he no longer believed it would come, Sandro slips into the room with a brain (short espresso, no sugar, of course!) and, discreetly, hands him the magic drink.

Architecture

BICA consists of three simple parts:

  • Slack Command: /bica used by ordinary mortals to request their coffee from their computer or mobile device (wherever Slack is running);
  • Server: a webservice that receives requests from Slack and serves a simple web page showing active requests;
  • Tablet: a screen placed by the coffee machine displaying the active requests page.

Slack Command

Slack allows us to create custom commands, which can call a REST endpoint. When someone types “/bica [something]” Slack makes a POST to the endpoint with a well known json content.

/bica coffee no sugar

This Slack command triggers the following request at the endpoint:

 POST https://bica.pminds.com/coffeeRequest
 {
    username: "diogo.figueiredo",
    message: "coffee no sugar",
    ...
 }

Simple. Next step: create a server service to parse this json and create coffee requests.

Server

We built a simple Scala server (Play Framework). We defined the “/coffeeRequest” endpoint that accepts the POST and JSON body.

def coffeeRequest(body: Request) -> {
    def arguments = body.fromJson()
    def request = memory.save(arguments.username, arguments.message)
 
   sendNotification(request.callbackUrl)

   Ok()
}

Part of the Slack request includes a callbackUrl that we can call to give feedback to the user. We used this to notify the user that (1) the request was accepted, (2) the coffee is on its way (further down the line).

Tablet

Finally, we had to decide how the requests would interact with everyone else. We knew we didn’t want spam (if the idea was to ask for coffee on the #general channel, BICA need not have been built).

We felt (as opposed to knowing) that, if it was to work, the process could not be complicated. We designed various wireframes and voilá! - a tablet placed by the coffee machine. Thus, whoever went to get coffee for themselves could take the opportunity to make someone happier by taking him a cup of coffee requested via BICA.

Bica Tablet

Metrics

We decided from day one that it would be very interesting (and somewhat important) to have metrics, to understand if BICA was being used, when, and by whom. We defined two simple events: the coffee request (along with who made it) and when are the requests being served. This allows us to know that last month 90 coffees were requested, 85% of which were delivered!

Other notes

For those of you that like technical details, we leave you with this appendix.

  • On the Server, we used the Play Framework because it comes with built in easy REST JSON request handling and simple HTML page serving;
  • On Slack, we decided that people could write what they wanted on the message. This message appears as-is on the tablet and that made things very simple (there is no need for the user to select among options and there is no need to build a parser or other complicated bits);
  • On the Tablet, we ended up writing up a simple Android app: a webview that loads BICA in kioskmode. Before we did that, someone would fiddle with the tablet once in a while and leave it running Youtube :-)

I want BICA too!

Of course! We’re open-sourcing BICA and creating an INSTALL guide. If you’d like to be notified when that happens, send us an email to bica@pminds.pt.

Happy Bica user