The impacts of the COVID-19 pandemic are legion; millions contracted the disease, hundreds of thousands have died, schools are closed, businesses are closed, the economy is in turmoil, and I'm working remotely once again. This last impact is the least concern, but as a software developer it's also the easiest thing for me to address in the immediate term.[ref]I am working hard to use my skills to affect positive change in as many areas as possible. Our company is still afloat and I'm still supporting my family. With what time I do have I'm donating to help other businesses and individuals stay afloat as well. This tutorial is meant to show the fruits of just one among many projects I have going.[/ref]

I've worked remotely before. It's an enjoyable work experience to skip your morning commute, make as much coffee as you want, and even take a break to have lunch with your family on a daily basis. It's a wonder more people don't focus on work-from-home as a default.

Unfortunately, not everyone is as comfortable switching to a remote, asynchronous interaction style as I am. This is most evidenced by the number of random "hey, you there?" or "got a sec?" pings I'll get on Slack without context. It's a bit frustrating to come back to a message like this after being offline for an hour or two while taking care of my daughter only to see the person who asked is now also offline and left no further details to their problem.

In a nutshell: Slack is asynchronous. We don't have to both be online at the same time to communicate.

How I Slack

In my career, I first used IRC. We had a dedicated, private channel for team communication and spun up one-off project channels when needed. Bots were used less for entertainment and more to keep a private channel private and controlled.[ref]Though once bot frameworks became a thing we totally started making our IRC bots smart![/ref] After IRC came HipChat with a strong integration into our other Atlassian-based tools. Now, though, my team is on Slack. It's still a great tool, but proper management of Slack requires a few specific things.

Firstly, I am strictly disciplined about my Slack status. I set an emoji to let you know if I'm home or (once this is all over?) in the office. If I'm out for childcare or family reasons I change my status. If I'm offline or at lunch I change my status.[ref]When I'm offline I also put my phone number in my status so my team can reach me in an emergency.[/ref]

I also update my Slack presence to let you know if I'm at my desk or not. If it says I'm here, I'm available. If it says I'm away - you can see where this is heading.[ref]Yes, I will sometimes be physically at my desk but marked "away." This is because I'm not working. I might be watching a video while eating lunch. Maybe I'm on a second computer checking my bank account. The point is that I'm unavailable.[/ref]

Despite my status and presence being solid indicators of where I'm at, some of my peers still fall into the "are you there?" trap and shout into the void when I'm not around. I decided to fix that.

The Slack Autoresponder

Slack has an API - I use it to set my status/presence with several keyboard shortcuts already. But it also has an event notification API that will proactively send data to a server to allow the server to script a response. In my case, this is exactly what I want.

Slack autoresponder in action
Slack autoresponder in action

In my situation, I want a Slack integration that:

  • Checks to see if this is an urgent message - if so, send me a text message
  • Checks to see if I'm set to "away"
    • If I'm away, respond with a canned "I'm not here" response
    • If I'm away but have sent a canned response in the past 10 minutes, ignore the message

My tools of choice: AWS Lambda, the Serverless Framework, and Ring Central.

I'll use Serverless to build my application, listening to Slack events and responding when the conditions are right. Because I don't have time to stand up a server (and don't want my local machine handling the influx of Slack messages), I'll host my app as an AWS Lambda function. To power urgent messaging to alert me when I need to head back to my desk immediately, I'll integrate everything with Ring Central's SMS APIs.[ref]You can also use Twilio if you want and my app can actually use either.[/ref]

Now that you know what tools I'll use and what I want to build, though, you'll have to wait until next time to see the secret sauce. Tune in tomorrow for Part II where I walk you through the app and the build.