Thanks to this awesome project for the template & idea. Also checkout his Medium post explaining the idea behind the project.
For your credit/debit card service, dive into their settings and turn on email notifications for every transactions.
For Venmo, you can either turn on email notifications for payments in the mobile app or here.
- Set up a zap in Zapier.
- Use email parser for the Trigger. This will parse the necessary information from your email. Send it a few emails to set up the parser correctly (Mine parses only the amount and the "description" of the payment/transaction).
- Set up auto forwarding to the email address (ex: expensetracker@robot.zapier.com) you just set up. For Gmail users, follow the instructions on Zapier.
- Go back to your Zap to set up the Action part. Choose Webhooks and select POST for this.
- Enter in the URL of your backend service of choice for the destination of the POST request.
- Turn on your Zap.
Ideally, every time your email service forwards a payment notification to this Zap, it would send a single POST request to your backend service with this following format:
{
"amount": "$15.00",
"description": "food"
}
Copy this workbook into your Google Drive.
Create a new project on the Google API Console. Go to the Credentials
> Create Credentials
> Service account key
.
Choose 'New service account'. Name it whatever you want, and remember to select Project
> Edit
for the role. Create the credentials, and save the associated JSON file with the necessary credentials/secrets to edit the workbook. Needless to say, don't put this on anything publicly accessible (repos, etc).
Finally, enable Google Sheets API for your project.
You can use the Flask application in this repo as is, although it may not work perfectly with your bank/card's email notifications.
Another option is to write your own in the framework of your choice, since it's really easy. The heavy work is (hopefully) done by your email and Zapier. All the server needs to do is to read the request and write the amount & description as a new row in the "Expenses" sheet of the workbook.
Optionally, you can also edit the workbook to best suit your needs, maybe to include for categories for your spendings.
Basically the workflow is like this:
Bank/Venmo email notification > Zapier > Backend API > Google Sheet.
-
I pay my friend using Venmo:
-
Venmo emails me with the notification.
- Gmail forwards it to my Zap.
- Zap fires off a POST request to my Flask application.
- The application adds the new payment as a new row in the 'expenses' sheet in the workbook.
- Tada!!!