DOORBOT

We hooked a Worker up to our office's door intercom, and it decides if it should let people in without asking humans.

When Workers were announced, we knew we wanted to learn more so decided to test on an internal project. As a learning started we looked for something that wasn't mission critical, wouldn’t require a lot of development effort, could be written in JavaScript/Node.js, and could be handled by any of our developers.

We Decided on DOORBOT: an internal need we've had for a while.

What's DOORBOT? Well, we get a lot of lunch deliveries. Our office building’s lobby door was connected to our office manager’s desk phone. She had to answer her desk phone and press 9 to buzz people up dozens of times during the 3 hour peak lunch span every day. We wanted to fix that.

The solution? Slack slash commands + Cloudflare Workers + Twilio

When our office manager enters the Slash command, a REST JSON request is sent to Workers. Our Worker checks that it’s a weekday, between 9->5, and that the request is coming from our office manager. If so, it SETs a value into Workers KV, storing that the door should be “unlocked” and what time that “unlock” expires (which is 2 hours after it's made).

When a delivery person buzzes our door, we forward the phone request to Twilio. We use a Twilio webhook to send a GET request to Workers. Workers checks KV to see if the door should be unlocked, and if so, responds to Twilio with a successful JSON response, causing Twilio to dial 9, letting the person in. If Workers doesn’t see an active unlock, it responds to Twilio with a failed JSON response, in which case Twilio forwards the call to our office manager’s phone.

DOORBOT was a huge success. Most importantly, it saved our office manager a lot of time and interruptions—at 0 ongoing cost. It also showed our team how Workers + Workers KV works, and helped us start learning best practices around managing and deploying Workers. We followed its deployment with an internal developer learning session, and started looking for client requests where Workers might be helpful.