We want our engineers doing one of two things in the office: developing software or playing Xbox (or foosball, or pool) to relax. When we moved to a bigger office, there was a lot more space to lounge around, so people developed the habit of ordering lunch to be delivered. The result was routine chaos at lunch time. Somebody had to be the ringleader, reminding everybody that it was lunch time, before taking orders down and emailing them to the caterer. There were mistakes, and some days employees got the wrong lunch or no lunch at all. Things got more complicated when we realized the caterer’s menu changed weekly.
Being engineers, we sought to optimize the delivery process by ordering together. And we discovered that fixing real-life friction in the office helped us understand how to solve it in our product too. Ordering lunch is a small problem, sure, but small problems have a way of growing with your company. Samba Tech is the largest online video platform in Latin America and we’re getting bigger, so over time, silly little logistical issues like this might cost our developers innumerable hours of productivity. Solving the lunch chaos problem let the engineers exercise a healthy kind of laziness by figuring out what could be eliminated from the day in order to better focus on what matters.
For us, the solution is a Gchat bot named BeeNorris that takes lunch orders via Gchat, compiles them into an order document and places them for delivery. It’s based on the Hubot project by GitHub. Working on BeeNorris gets our engineers thinking about our company as a system, and asks them to consider their own needs and the needs of coworkers as a part of that system. Accordingly, our bot turned out polite and thoughtful, helping us automate while also anticipating our mistakes. BeeNorris has been so effective at automating annoying tasks that our developers have written more than 200 other scripted commands for him, including the ability to interact with our Rest API to return results, or deliver progress updates on a product release. All through Gchat.
When we set out to solve the lunch ordering problem, we needed to give BeeNorris some simple commands that could condense the process into a few simple sentences. Personifying BeeNorris helps us think in natural language, which is a good way to train yourself to write the verbiage inside any software.
To place the order, the user types “Order lunch” in a GTalk chat with BeeNorris. Then, it answers with “This week it’s Menu X + the link to the menu,” which is hosted on the caterer’s site. He stops collecting orders at 11AM, and loads them all into a Google Doc. The bot then emails a link to the document over to the caterer, and sends a confirmation email to everyone who placed an order.
BeeNorris sends a reminder message via Gchat at 10:50AM: “Ordering lunch in 10 minutes…”. If an employee hasn’t requested anything, BeeNorris emails them the number of the caterer in case they want to phone in a late order.
Our developers have scripted over 200 other commands for BeeNorris, including:
- It provides information about the progress of our internal product development releases, warning us if the delivery objectives were or were not met.
- It interacts directly with our API Rest, providing us with real-time information of averages directly in GTalk.
- It calculates estimates of data traffic consumption for potential sales of the Live Streaming solution.
- It dynamically monitors the status of all of the services involved in our platform.
- It informs us of the resolution of all tickets and calls to our Support team (Ex: how many tickets were open, if there is a ticket for a certain client…).
- It informs other members of the Samba Tech family of the people responsible for the Support team on that day and their contact number.
The basis for BeeNorris is an open-source project called Hubot, which the folks at GitHub wrote to eliminate their own distractions. We chose to integrate this bot with Gchat because it’s our main internal communication tool, and it’s available on all different platforms and devices.
Hubot was written by GitHub in CoffeeScript on Node.js and you can deploy it on a web-app hosting platform like Heroku. The only other component you need is NPM, but you’ve already got that if you’re running Node v0.6.3 or greater. You can read how to set up Hubot in this ReadMe.
One more step: For Gmail integration, you’ll begin by creating a company user email account for the robot, so that those who wished to receive its notifications can add it as a Google contact. In our scripts below, you will see areas in the code where you can plug in the Google account credentials of your new bot.
BeeNorris is always on Gchat, listening for menu requests. When an employee contacts him to ask for the menu, he replies with a link to the appropriate menu. If it’s after 11AM, BeeNorris informs the employee that it’s too late to order, but he also gives them the phone number of the caterer, so he can try to sneak in a last-minute request.
Above, the bot listens for menu requests and prepares its responses. Below, the logic BeeNorris uses to determine which version of the catering menu he should display.
After the orders are in, BeeNorris constructs a spreadsheet in Google Docs, where our order history lives; you can see this code below. He then takes the orders from today’s document and places them in the body of an email, which he sends to the caterer. He also alerts users if something has gone wrong with his ability to order, so they don’t end up lunchless.
Below, once BeeNorris has all the orders, he emails the entire company with the receipt, so they everyone’s clear on who ordered what. This reduces confusion once the food arrives; the pace of development at Samba Tech is fast, and sometimes we forget what we’ve ordered.
The complete code for lunch order functions, messaging, alerts, and sending the final Google Doc of orders are here and here. These scripts were written by Lídio Ramalho, Felipe Machado, Charles Ferreira, and João Maciel at our office in Belo Horizonte, Brazil.
You can write and share scripts between other robot people have built here. If you’ve written one of your own, add it in the comments.
Since a lot of dev shops use HipChat over Gchat, you may also want to check out a version of this bot for HipChat, which uses the Ordr.in restaurant management API. It was built by GitHub user jimtla and is located here.
[Image: Flickr user Jeremy Brooks]