Unemployment Reminders with Python, Flask, and Twilio Autopilot

How I built a side project to learn new skills, have fun, and find a new job.

Like many other developers I found myself without work during the COVID-19 crisis. Since I'm always working on side projects anyway I naturally started looking for a problem I could solve with software to keep my skills sharp during this period of unemployment. It wasn't long before I found one.

What does it do?

It's an SMS chatbot that will remind you to certify for unemployment benefits on your certification date. In Illinois certification is required every 2 weeks.

What problem does it solve?

The Illinois Department of Employment Security (IDES) website makes no attempt to communicate with you via email, SMS, or any other widely available means of digital communication about any aspect of your benefits claim. /rant

Out of frustration I wanted to fix one tiny part of a massive digital communication problem with the IDES website and this is what I came up with.

Screenshot of SMS messages in iPhone

Goals and Approach

Although this is a side project I decided to set some goals up front.

Learn something new
I already have a good amount of experience with PHP, Node, and AWS but now was the time to force myself to use new tools. I had been wanting to learn Python for a while so that's where I'll spend most of my time.
Be professional
Create pull requests, write unit tests, set up a build server, and be security conscious just as if I am working with other developers at a company.
Deploy to production
If it's not in prod it doesn't count.
Definition of DONE
It's not done until I write documentation for other developers, release it on GitHub, write this blog post, promote it on social media, and add it to my resume.

Tech Stack

Here's the tech stack I came up with and my thought process behind the decisions.

Python, Flask

These are the primary tools that I wanted to learn on the project and where I focused most of my time. I spent a lot of time reading docs, learning about imports, choosing the best libraries, and writing unit tests.

Twilio

Twilio is another platform I was eager to get hands-on experience with. They are changing the way companies build digital communications into their products and recently gained headlines for powering New York City's contact tracing initiative. I'm thrilled to continue seeing all the ways tech companies can help us through this crisis.

I used Twilio Autopilot to build the chatbot and Programmable SMS for the reminders.

I used their excellent Python Helper Library for sending SMS messages and validating webhooks.

AWS

Since this is a side project I needed to keep my infrastructure costs as low as possible. The combination of API Gateway, Lambda, and DynamoDB is the least expensive infrastructure AWS offers for serving a web request so I was hopeful that I could make this work. I would need two Lambda functions: One for handling the incoming webhooks from Twilio and one for sending SMS reminders on a schedule.

The only remaining blocker before going all-in was:

How do I get Flask running on Lambda?

Without clearing this blocker I would have to go the more expensive route with EC2 or Fargate.

Serverless Framework

While researching solutions to get Flask running on Lambda, Serverless Framework appeared to be the best option. Specifically the serverless-wsgi plugin appeared to be just what I needed.

Not only did Serverless Framework solve my "get Flask running on Lambda" problem I also found that its workflow helps you deploy to AWS early and often. Despite the learning curve to pick up the framework it was a definite win for speeding up my DevOps tasks.

Test Coverage

I didn't feel my first cut at learning Python would be complete unless I became familiar with a test framework and wrote some unit tests. I used the built in unittest package and nose2 as my test runner.

Code coverage report

Demo and Code

Disclaimer

This application is for demo purposes only. It is not affiliated with or endorsed by the Illinois Department of Employment Security (IDES).

This demo may disappear at any time. Do not use this as your only reminder.

I'm sorry. Something went wrong.

My site is having trouble sending the message. You can try:

Success

Thanks for trying the demo. You should receive an SMS message shortly with instructions for using the chatbot.

Enter your 10-digit phone number to try the demo

Messaging and data rates apply.

Get the code on GitHub

Thanks for checking out my project. Don't hesitate to reach out and let me know what you think.

P.S. I'm looking for a new role with a great company.