In this post I present a way to import bank transactions from unsupported banks into YNAB using their new API. This solution also provides a workaround to get transactions from supported banks into YNAB without disclosing your banking login details to third parties (which you should never do).
This post is geared towards those who have some experience tinkering with Python and Home Assistant. As a smart home enthusiast, my server of choice is Home Assistant because it provides a simple way to self-host a Python backend on a server that is running 24/7 anyway.
A side effect of this setup is that you can access your bank transactions from within Home Assistant and trigger automations based on it. (This is optional of course and you can use HA as a simple gateway)
If you do not use Home Assistant, the alternative would be to stand up a webserver with exposed domain and implement a simple Python server, reusing some of the logic in the provided code.
- Enable notifications from your bank’s mobile app
- Set up IFTTT applet to capture the notification and send all data to a webhook
- Set up Home Assistant component
- Create YNAB API key to use in component configuration.
I will trust you to complete step 1 without instructions. Once done, continue as follows.
Here is a diagram. Sequence of actions
Step 2: If This Then That
Set up an applet using the
Android Device > Notification from App and
Webhook components in IFTTT.
Fill the required configuration details shown below:
Image showing Notification capture config
Image showing Android Notification config
Follow the instuctions provided in my repository component for setting up the component. Simply copy the python file to your Home Assistant
custom_component directory within your configuration root directory.
Create a YNAB API key by following their instructions and add this to the component configuration.
You should now be able to receive notifications from you bank, which are picked up by IFTTT and forwarded to the Python endpoint on Home Assistant. This Python endpoint in turn uses your YNAB API key to create a transaction in your YNAB account with the details contained in the Bank notification. Depending on the format of the bank notification text, you might have to tweak the Regex a bit.