Bunq2Ynab is a Python script that synchronizes bunq accounts with YNAB accounts.
You'll need a token from both bunq and YNAB to enable synchronization. Both tokens are hexadecimal and 64 characters long, like 7197c12ef0eae4572dfb85706353e6a98410b3a7bbe598726404072decd1d664.
The easiest way to run Bunq2Ynab is in the Amazon cloud. You can also run Bunq2Ynab on a local python installation. Both options are explained below.
We've published Bunq2Ynab as Serverless application on the Serverless Application Repository. This makes it easy for you to deploy the synchronization in the cloud, without running it yourself. Because of the Serverless approach costs should only be a couple of cents a month at most.
Available Applications
, then Public applications
, select Show apps that create custom IAM roles or resource policies
and search for bunq-ynab-aws-lambda
.BunqApiToken
, YnabAccessToken
. You can keep YnabBudget
as *
.I acknowledge that this app creates custom IAM roles.
checkbox. An IAM role has to be created to store configuration in Systems Manager Parameter Store.Bunq2Ynab will automatically match accounts by name. If your names match you can continue to 'Activating Sync'.
We strongly recommend that you name your accounts in YNAB and Bunq the same. You only need to alter the configuration IF your Ynab account names do NOT match your Bunq account names.
To alter the configuration:
bunq2ynab-config
, and select edit
. Populate as follows, make sure you JSON is valid.{
"api_token": "AlreadySet",
"personal_access_token": "AlreadySet",
"accounts": [
{
"bunq_account_name": "your bunq account name",
"ynab_budget_name": "your ynab budget name",
"ynab_account_name": "your ynab account name"
},
{
"bunq_account_name": "another bunq account name",
"ynab_budget_name": "another ynab budget",
"ynab_account_name": "another ynab account"
}
]
}
Here's a screenshot of the account and budget names in the YNAB website and the bunq app:
serverlessrepo-bunq-ynab-aws-lam-Bunq2YnabFunction-<GUID>
4. Finally Click Test
to execute the function once. This will activate the sync from Bunq2Ynab.
set_callbacks | Adding callback MUTATION:
.Done! Your transactions should now sync automatically.
Bunq2Ynab requires Python 3.5 or higher. Install this however you like; on my Raspberry Pi with Raspbian, it's sudo apt-get python3
. You can install the required Python packages with your OS's version of pip3 install -r requirements.txt
.
git clone git@github.com:wesselt/bunq2ynab.git
*
or omit the row entirely to have Bunq2Ynab match accounts by name. Note that if you wildcard the YNAB budget name, one bunq account may end up synching with multiple YNAB accounts in different budgets.{
"api_token": "your bunq api key",
"personal_access_token": "your ynab personal access token",
"accounts": [
{
"bunq_account_name": "your bunq account name",
"ynab_budget_name": "your ynab budget name",
"ynab_account_name": "your ynab account name"
}
]
}
python3 list_user.py
python3 list_budget.py
The bunq2ynab.py script synchronizes once. You can run this from a cron job to synchronize on a schedule.
python3 bunq2ynab.py
For the first run, you can add --start 2022-12-31
to specify the start time, or --all
synchronize all transactions.
Run auto_sync.py
to set up a callback and start listening for push notifications. If you have a private IP, the script will look for a UPNP gateway and set up a port forward.
python3 auto_sync.py
Auto sync tries to run as reliably as possible. Every 8 hours it refreshes the port forward. This way it keeps working when your ISP assigned IP changes. After refreshing the port forward, auto_synch synchronizes even if it has not received a callback.
These configuration settings configure the email capability:
{
"smtp_user": "example@gmail.com",
"smtp_password": "xxx",
"smtp_server": "smtp.google.com"
}
Optionally you can configure number of errors that occur before a mail is sent (the default is 5.) You can also specify the email to and from:
"mail_after_errors": 1,
"smtp_from": "bunq2ynab@some.where",
"smtp_to": "example@gmail.com"
Adding autosync as a systemd service
sudo nano /etc/systemd/system/autosync.service
Copy paste script below
[Unit] Description=Autosync BUNQ2YNAB script
[Service] User=beninho ExecStart=/usr/bin/python3 /pool/apps/bunq2ynab/auto_sync.py Restart=always
[Install] WantedBy=multi-user.target
sudo systemctl enable autosync.service sudo systemctl start autosync.service systemctl status autosync.service