Skip to content
No description, website, or topics provided.
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Mint Scraper And Notifier

A script that serves two functions.

  1. Scrapes Mint for daily spend and income
  2. Sends me a text with my aggregrate and itemized spend/income every night at 10PM


I wanted to get better insight into my daily spending. There are many spending apps out there, but they offer more features than I want and lack the simple notifications I do want. This began as a weekend hack project that eventually grew into a more robust app driven by Plaid.


This solution is hacky! And I love hacky things :)

This is a general overview of how the script interacts with Mint

  1. The script simulates a browser with Capybara/Selenium
  2. The script visits the Mint homepage
  3. The script logs in with username/password
  4. Mint will then text you a login token to your phone
  5. The script finds the Mint text by looking through your local iMessage chats
  6. The script inputs the login token and completes authentication
  7. The script navigates to the transactions page
  8. The script collects all transactions for the current date
  9. The script creates a summary message of the transactions and uses Twilio to send you the summary message


  • Ruby and Bundle
  • Mint Account
  • Twilio Account
  • Macbook, iPhone, and a shared iMessage account between the two devices


  1. Clone the repo
  1. Install gems
$ bundle i
  1. Download both the chromedriver and geckodriver, and put them somewhere in your PATH. At the time of writing this doc, I'm using version 2.46 of the chromedriver but you can find the latest version here.

    If you want to run this app without making any changes, add these two executables to the directory $HOME/.chromedriver. Then add that directory to your PATH.

  2. Copy the env template and fill it out with your values

$ cp .env.template .env


There are two main ways to run this program.

Run Manually

This command will immediately send a text with today's spend/income. This is useful to test that everything is setup correctly.

$ bundle exec ruby main.rb

Run Periodically

The real reason I built this script was to receive a text every night with my spend/income. To do that I used cron.

When a script is run via cron it doesn't have the same PATH or other environment variables as when you are running the script yourself. For example, if I used this cron command...

0 0 22 * * bundle exec ruby /Users/codemang/Personal/mint/main.rb

It would use the system ruby. This would break for me, because I use a different version of ruby when developing. Gems that have been installed are scoped to the ruby version, so my system ruby would not find the required gems for this script. It would also likely complain that it couldn't find the chromedriver executable.

To solve this problem, I created a bash script which would first configure the environment. The three things that needed to be done were...

  1. Use the correct ruby build. I use chruby to manage my ruby versions so you can see calls to their startup scripts.

  2. Add chromedriver to the path

  3. Call the script

# Add chromedriver to path

# Switch to using chruby ruby so gems can be found
source /usr/local/share/chruby/
source /usr/local/share/chruby/

# Call the script
cd "$( dirname "$0" )"
bundle exec ruby main.rb schedule

Now I can add this to my crontab and the script will run successfully.

0 0 22 * * /Users/codemang/Personal/mint_notifier/

Lastly, since I only want to receive one text at 10PM, I could try to setup my cron as above. But what if I had my computer closed? The script wouldn't run and no text would be sent for the day.

To make this more resilient, I run the script every five minutes and track when texts have been sent to avoid double texting. If my computer is closed at 10PM but I open at 11PM, it will send the text then. Additionally, if my computer has been closed for multiple days, it will send texts for those missed days.

To enable this functionality, you just have to pass in schedule as a command line argument, which you can see in The final cron command is...

*/5 * * * * /Users/codemang/Personal/mint_notifier/

Viewing The Browser

If you want to view the browser as it is being automated, just call the script with VISIBLE_BROWSER=true

You can’t perform that action at this time.