Mint Notifier

A headless chrome script which would scrape Mint for daily spend/income and text me a summary every night

browser automation

selenium

The Problem

I love building custom tools that solve a unique problem in my life. As I transitioned from a full time Product Manager to a one day a week Engineer (goodbye income), I realized I needed more visibility into my spending habits. There are a variety of spending apps that already exist: Mint and Wealth Front come to mind. However, their UI's are cluttered with unnecessary features and they don't offer the customization I want in a spend tracking app.

The Solution

But wait! Mint already had all my spending data. Using a headless browser I could scrape my spending data, manipulate it, and report it in my preferred format. I began hacking away at this idea that weekend and quickly had a working prototype. By midweek I had a polished solution that is still sending me spending summaries two months later!

Continue reading to better understand how the app works, or check out the Github repo. You can also read a detailed tutorial in which I break down how the code works.

Solution Details

Coming from a ruby background, I turned to Capybara and selenium for browser automation. I first started by trying to login to Mint via the following steps.

1. Visit mint.com
2. Press the "Login" button
3. Input email and password
4. Press Enter

This was simple enough to implement, but I quickly encountered a problem. Every time I ran the script Mint would register the browser as a new device and require 2-Step verification via text or email. Since I have a Mac and an iPhone with a shared iMessage account, I figured I could access my texts on my computer. Sure enough, iMessages are stored unencrypted in an accessible directory. The next steps of the script are...

1. Click "Send text" button to receive login token
2. Find all iMessage files for the current day
3. Find all messages that have "Your Mint Code" and parse out the code
4. Input the code and press enter

Now that we've authenticated, we can continue on to the data.

1. Click the "Transactions" button to visit the transactions page
2. Find all transactions for the current date
3. Use the Twilio API to send a text with that data