Nik Spyratos

Build Your Own Budgeting

Table of Contents

I've been on a bit of a banking tech bender of late. It's no surprise given I worked so deeply around that ecosystem for while recently.

While this post focuses on South African banks, I don't see why the same is not doable for many banks globally - so long as you get either SMS or Push notifications on your transactions.

This year, I joined the Investec Programmable Banking community for both personal and professional reasons. My day job had a use case for Investec's API, and I was keen to be able to access my banking data programmatically. So I signed up, had a few calls, and slowly over the course of a few months became familiar with the Investec API.

I won't go into the details of how to use the API for businesses here - see my consulting site for that. What I will go into here is how I used the Investec API and other tools in order to gain near-realtime visibility into my transactions, for use in personal budgeting apps or general transaction tracking.

Step 0: Why do I want to do this?

For years, as part of my knowledgebase, I also tracked all my transactions by hand. Less so for hardcore accounting, but more for managing budgets and having an idea of what all my monthly expenses are.

I used my own custom formatting with Markdown for this budgeting, but it was tedious as my financial life grew more complex with home loans, insurance, finances, and international transactions. I'd been longing for a good way to automate this for a while.

There are apps in this space already - things like You Need A Budget and 22seven. However, especially for tools like the latter, I dislike how it categorises transactions automatically. Often this was inaccurate for me, or I needed some transactions to represent multiple amounts in different categories (e.g. a supermarket transaction can count both for a grocery budget and a junk food budget). Having to manually manage this seemed no different to just writing everything down myself.

The other alternative is track high level stats or copy data off of my monthly bank statements. This will be accurate, but very much time delayed and thus useless for knowing at a glance what my balance & budgets look like. It also doesn't help that if I wanted to get this data in Excel format, for most banks I'd have to do that manually. Shoutout to Bank Zero for sending both statements and excel in the same monthly email and boo to FNB for wanting to make monthly statements a pain/extra charge to manage.

Web scraping is an option, but that usually falls foul of terms of service of the usage of the banking web apps, and with ever-changing UIs and security measures, it's a ton of maintenance. Not worth the burden for many solo developers (or even businesses I reckon).

I'd also been itching to build something personal for a while, and get some practice with tools in the Laravel ecosystem like Filament.

In classic developer underestimation, I thought "I could do this better for myself, if only I had the control". Luckily, with Investec's API I would have an easy path to write my own budgeting app.

First Step: Investec API

Investec's API documentation can be straightforward, but perhaps misses a bit of context on getting set up. That's where the wonderful wiki by the folks at Make comes in with guides on getting set up with credentials to start using the API and card programming.

With some trial and error, and generous community contributed request samples, it was fairly simple to get up and running to synchronise my accounts & transactions to my app.

[!note] In the process of my personal & business implementations of this API, I ended up building an SDK for PHP users, available here.

Card Programming

Another neat feature offered in this ecosystem is programmable cards. You can write custom JavaScript code that will execute before & after a transaction happens on a card. This can be used for transaction logging, but more importantly authorising transactions - a great way to stop yourself overspending on certain items.

I didn't need full realtime processing like this to store my transactions, and the API has a bit more information on a transaction, so. I stuck with that.

Next: What about banks that don't have an API?

While Open Banking is nascent in South Africa, there aren't really any other APIs available to consumers for their own banking data. I have a bond with one bank, and a credit card with a large chain store (conveniently run under-the-hood by the same bank as my bond).

This brings us back to the original issues: Statements are accurate but too delayed, scraping is too much maintenance (and not possible for app-first banks like BankZero), and there aren't really other signals I can use here. Or aren't there?

I get SMSes and push notifications for transactions. I'm sure there's a way to access the message contents?

Enter: Automate.

Intercepting your own Push & SMS notifications with Automate on Android

In college I'd been told about a cool app called Automate. It was a flexible drag-n-drop logic flow builder that let you do almost anything on your device. A friend of mine was using it to automate viewing ads for in-game currency on cheesy mobile games.

Surely I could use this to get the incoming SMS/push, and send the data to an API I built? Of course!

[!note] I'm not aware of an equivalent app or feature on iOS. I know Samsung/Android has a Routines feature nowadays that can do something like this, but I don't know if it can do arbitrary HTTP requests. If anyone knows something that could do this, let me know!

I started with the SMS implementation. I built a simple loop flow that waited for any SMS, and then sent the entire message contents to my API. I did it this way because I wasn't quite sure how to build filtering into my Automate flow, so it was just easier to let my Laravel app do it instead.

I implemented the same for Push notifications from another banking app, and wrote a parser in my API for it too.

The only "untrackable" accounts left are debt servicing, since those don't give notifications. Perhaps PDF parsing statements would make sense for those. Since they're a low transaction volume, I can just reconcile that manually in my budgeting system every once in a while.



I hope to see more APIs become available to ordinary consumers as well as businesses - currently it's difficult to get API access to many banks in South Africa as they don't really entertain "small fries". Any progress with Open Banking is welcome.

If you enjoyed this piece, consider subscribing.

If you'd like more information about using Investec's API in a business context for your customers, chat to me here.

#API #android #budgeting #finance #investec #niksoftware