Automatically import transactions to YNAB

Happy to give a few pointers if you want them?

So assuming you have got / can get your YNAB API token.

From there.

HEROKU

The “with Webhooks” section of the Github site will give you this link:
https://heroku.com/deploy?template=https://github.com/scottrobertson/fintech-to-ynab

And will ask you to recreate your own version of it. Create a heroku account, etc. Then create your own “deployment” in Heroku:

image

The “app name” bit will become part of the URL you’ll use later. I just used “bens-ynab-importer” (will become “bens-ynab-importer.heroku.com” for later stages where you need a URL. Back to that later.

Next you’ll come up to the “config vars”, which is where you need to enter your YNAB API tokens, account references, and budget references.

image

YNAB_ACCESS_TOKEN is the one generated by the YNAB API Page - which you should already have.

For the next two points, if you log into your YNAB online account, open the relevant budget, and click into your Monzo account on the left pane. The URL will look like this:

https://app.youneedabudget.com/**[a random set of numbers]**/accounts/**[more randdom numbers]**

The first set of numbers is your YNAB_BUDGET_ID - enter that into said box.

The second set is the your YNAB_ACCOUNT_ID - or rather, the ID of the account you want the data to Sync to. Enter that in there too.

The last entry, URL_SECRET says optional - I think it’s used to verify that the right account/data is being synced - I just put a random word in here - but if you use it, it will come back later as part of the overall URL you’ll need.

(Basically, the URL you will need is "https://[your-app-name].heroku.com/monzo[?secret-phrase-if-you-used-it]

ON TO MONZO!!!

The Github guide then points you here for the Monzo set up.

https://github.com/fintech-to-ynab/fintech-to-ynab/wiki/import:-Monzo

Firstly, go to this page to access the Monzo API. Sign in and do the email magic link thing and you’ll be presented with an dashboard to generate your “webhooks”. Basically, I understand that these webhooks are what you need for the API to work. Groovy.

This is where I got stuck because the instructions from here are unclear… So…

First, in the API section:

You will have a screen like this:

image

Now the first problem I had was that the “account ID” that the Github guide tells me I need, is actually the account ID of the pre-paid account. If you started with Monzo in the pre-paid phase you’ll need to take some extra steps.

First, click on “list accounts” in the End Point List. It should say “GET /accounts”. Press send, and you’ll be presented with a list of account ID’s.

You should see one with the attributes of:

  • Closed = False
  • Type = UK_Retail
    and with your name, sort code, account number etc.

Copy the id from this page - should be “acc_” and a long string. Paste this into notepad or somewhere you can access later.

Now go to “Register Webhook”. You should see:

image

Now replace the $account_id with the ID you’ve just found (without the dollar sign) but keep the quotes.

The URL should be replaced with the URL of your heroku app, with your secret term appended if you’ve chosen one.

Should look like so “https://[your-app-name].herokuapp.com/monzo?secret=[your-secret-word]” (if you didn’t use a secret word, omit everything after “monzo”)

Or like so in the box, curly brackets and quotes in the same places:

image

Once you’ve got that edited, click on the “Send” button, and it should register.

If you then go to “List Webhooks”, and press the Send button, the info you’ve entered should come out on the other end:

image

Once all those variables are in place, make sure you’ve pressed “Deploy” on the Heroku page. AND THAT IT IS.

From here on out, any transaction (including moving money to pots) will appear on your YNAB Monzo account page.

Hope that is helpful :slight_smile:

9 Likes