Monzo to YNAB IFTTT Integration

We're big fans of Monzo here at YNAB!  That probably has something to do with Graham, our lead Android developer, being a Monzo customer and telling us about all the neat things Monzo is doing lately. 

Recently, Monzo added an IFTTT Service which makes it really easy to create integrations based on your account activity. 

Here, I'll show how to automatically import Monzo account purchases to YNAB, using the new API. 

A few days ago, I posted Using IFTTT with the API which explains how to creation transaction in YNAB using IFTTT.  This walk-through uses most of the same steps but there are a few differences.

We're going to use the IFTTT Platform, which is a special area on IFTTT's website where you can build your own Applets with more options and control than have through the main IFTTT site.

So, go to https://platform.ifttt.com and click "Join Now" (if you haven't joined already).

Once get your IFTTT Platform initially setup, you should be able to create a "New Applet".  The screen will look like this:

Select "Monzo" as the trigger service and select "Any card purchase".

Next, you'll want to add "Filter Code".  This is some simple JavaScript code that will be used to transform some of the data and prepare a request to be sent to YNAB.  My filter code looks like the following:

 

    

If you want to copy/paste that example, here you go:

const account_id = "31656018-364d-FAKE-3bf5b119f3d3";
// Use current date in ISO format (i.e. '2018-06-02')
const date = Meta.currentUserTime.toISOString().substr(0, 10);

const account_amount = Monzo.cardPurchase.AmountInAccountCurrency;
// Convert account_amount to milliunits and use negative
// amount so it will be entered as an outflow
const amount = -Number(account_amount) * 1000;

const payee_name = Monzo.cardPurchase.MerchantName;
const memo = "I came from IFTTT!";

// Use an import_id consistent with other imported transactions
// to prevent duplicates when doing File-based import
const import_id = Monzo.cardPurchase.TransactionId;

let transaction = { account_id, date, amount, payee_name, memo, import_id };
let body = JSON.stringify({ transaction });
MakerWebhooks.makeWebRequest.setBody(body);

Note: You'll want the account_id in the filter code to match the account_id on your own budget where you want the transaction to get created.  You can find this by doing a GET request on /budgets/{id}/accounts through the API or by simply opening up the YNAB app on the web, clicking on the desired account on the sidebar and noting the account_id in the URL.   Actually, to keep things simple, just do that.  Open up YNAB in a browser and select the target account. The format of the URL when you click an account on the sidebar is:

https://app.youneedabudget.com/{budget_id}/accounts/{account_id}

While you're at it, note that budget_id there too, because you'll need it next.

Finally, you'll want to "Add action" and specify "Webhooks".  This service will allow us to send a request to the YNAB API.  You'll need to have your budget_id and access_token handy for this. 

Specify the URL in the format:

https://api.youneedabudget.com/v1/budgets/{budget_id}/transactions?access_token={access_token}

The Method should be specified as "POST", Content Type specified as "application/json" and Body left blank.  All of the Visibility radios should be "Set by you".

Give your applet a nice title and description and then click Save!

Now, your new applet should show up in your "Private Applet" list.  You'll now want to click "Enable it on IFTTT" so that you can actually use it.

 

 Now, you'll be taken back to IFTTT (remember, you have been on the IFTTT Platform site up to this point, not the main IFTTT site) and you will be able to toggle it on by clicking "Turn on".  When you do this, IFTTT will ask you to authenticate Monzo and once that is done, the applet will be ready to run.

It's time to test.  How do you test this?  Go buy something of, course. 🙂

Caveat

The Monzo IFTTT Service only triggers for purchases and not for other account activity such as payments or transfers.  So, you'll probably want to use File-based importing occasionally to import all the other activity, unless of course you are entering those transactions manually.

Have fun and let us know what you build!

25replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hello Brady,

    The API is such a cool service that allow amazing integrations.  As I'm in the process of creating an import integration to Israeli banks, I did something similar. I might be wrong here but I think you need to extend the handling of the import id suffix (the constant :1) otherwise the user will lose transactions.

    Please see details in a thread I opened 3 days ago (second reply) - link

    Thanks for your great service

    Eran.

    Reply Like
    • Eran Sakal Thanks - I'll respond over on that other thread.

      Reply Like
      • Eran Sakal
      • eran_sakal
      • 11 mths ago
      • Reported - view

      Brady Hi,

      I read you response, thank you for the reference to the model section I missed that part.

      Following the documentation I think you are missing the 'occurrence' handling part in this post.  in the code snippet above you set occurrence to hardcoded ':1' which will filter out other occurrences transactions of the same import id.

      Eran.

      Reply Like
    • Eran Sakal Thanks!  I just updated it to use Monzo.cardPurchase.TransactionId which is a unique id from Monzo directly which should work well.

      Reply Like
  • Hi Brady,

    This is pretty great. I was already using the 'Fintech to YNAB' app that someone made to do this, which is amazing, and as it supports all payments, not just card payments, I'm going to stick to that for the time being.

    I was wondering, are there any plans within YNAB to officially support IFTTT? It would be excellent to be able to have YNAB-based triggers in addition to being able to use the API as you explained to carry out actions.

    In fact, in conjuction with Fintech to YNAB, this would be potentially much more powerful than the current Monzo integration due to supporting all transactions, not just card payments, not to mention the fact that it would work with all banks, not just Monzo.

    My main use case: it would be amazing if I could send a message to my partner with a generated monzo.me link every time a transaction within a certain YNAB category got added to my budget. I've currently got this set up using Monzo's IFTTT but it's very limited, as it won't include bills that go out via direct debit.

    We could use the integration for lots of amazing things like changing the colour of lights when going over budget - or maybe even adjusting the thermostat if the energy budget gets low! There are pretty much limitless ideas, and I'm certain that people who aren't fortunate enough to be able to use Monzo would appreciate it even more than I would.

    Reply Like
    • Green Horn We are currently looking into an official YNAB Service on IFTTT.  We like the idea of this!

      Your idea re: links to monzo.me on spending sounds like a great (and fun) idea! That would be really awesome.

      Thanks for sharing your project idea - we always love to hear these.

      Reply Like
    • Brady launching an IFTT service would let us non coders in on the API

      Reply Like
  • Hi,

     

    Is there a way to specific the monzo account that you want the service to query? As they now support multiple accounts (Joint Accounts)

    Reply Like
    • Cyan Koala I'm not sure and Graham, who is the lucky one on our team with a Monzo account only has a single Monzo account so we can't confirm.  When you link IFTTT to Monzo, it might ask you which account you want to link and if that is the case you might only be able to link a single account at a time.  Or when the trigger fires, there might be an ingredient (in the script above, another example of an ingredient is Monzo.cardPurchase.MerchantName)  that indicates the source account, and you could use that to route the transaction to YNAB. 

      Let us know if you find out for sure!

      Reply Like
      • Cyan Koala
      • Cyan_Koala.1
      • 10 mths ago
      • 1
      • Reported - view

      Brady I just did a test transaction and does not show up in ifttt. When you add the Monzo service there is no way to select an account. 

       

      Joint accounts are are currently in beta, so perhaps they will update ifttt in the future. The reason I asked is that joint accounts are accessible via their API, but I guess not with their ifttt service 

      Reply Like 1
      • Freitas
      • Violet_Captain
      • 10 mths ago
      • Reported - view

      Cyan Koala same here.. joint transactions won't show up.

      Reply Like
    • Matt C
    • mcothier
    • 9 mths ago
    • Reported - view

    This is exactly what I been looking for - thank you! :D

    How easy would it be get it to use the most frequently used category associated with the payee when updating YNAB?

    Reply Like
    • Matt C - If you specify an import_id, as I did in this example, Renaming Rules (Under Manage Payees) will be applied when the transaction is imported.  This, in conjunction with, the 'Automatically categorize payee' setting will allow you to automatically categorize imported transactions.  For example, if Monzo has the payee (Monzo.cardPurchase.MerchantName)  specified as PENNYWISE, you could have a payee setup in YNAB that looks like the following, which would result in the imported transaction being categorized to "Electric" and using the payee name "PennyWise Electric". 

      Reply Like
    • Matt C
    • mcothier
    • 9 mths ago
    • Reported - view

    Great - thank you! I realised that the payee had entered as Sainsbury's instead of Sainsburys and that was why it didn't automatically categorize!  I had no idea about the renaming rules feature, will definitely come in handy!

    Reply Like
    • Matt C
    • mcothier
    • 9 mths ago
    • Reported - view

    Thanks again for this!  I have come across one issue that I was hoping you might be able to help with.  I have just switched on the "rounding up" feature so that my spare change goes into a savings pot.  The problem is, the transaction that gets pushed into YNAB is the pre-round up amount and therefore I have to manually adjust it.  Is there any easy way of fixing this please?

    Reply Like
    • Thom Warren
    • Product Manager
    • Sea_Green_Song.2
    • 7 mths ago
    • Reported - view

    Is there a way to specify which YNAB account is your monzo? I have multiple accounts in YNAB and with the example URL it just defaults to the first one in the list. I've tried changing the URL to

    https://api.youneedabudget.com/v1/budgets/<budgetID>/accounts/<accountID>/transactions?access_token=<token>

    Which gets me the correct response when I to a test GET with Postman but the POST endpoint has the account specified in the body. 

    https://api.youneedabudget.com/v1#/Transactions/createTransaction

    Reply Like
    • Thom Warren 

      You'll need to specify the account in the body of the POST as account_id.  If you need to do some mapping from Monzo to YNBA account_id that could be done in the Filter Code itself.

      Reply Like
    • Brad B
    • Salmon_Jackal.3
    • 6 mths ago
    • Reported - view

    Is this the most up to date / best method for syncing Monzo with YNAB? Is there anything more official planned or is this considered the official support?

    Reply Like
  • Brad B You might want to give Scott Robertson 's app Sync for YNAB a look - it's a new service that integrates YNAB with Monzo (and many other banks). 

    Reply Like 1
      • Brad B
      • Salmon_Jackal.3
      • 6 mths ago
      • Reported - view

      Brady Thanks for the suggestion. Out of interest, if just wanting Monzo sync to YNAB and nothing more, is there something lacking with the IFTTT method?

      Reply Like
    • Brad B Not that I'm aware of.  It should work.

      Reply Like
      • Freitas
      • Violet_Captain
      • 6 mths ago
      • Reported - view

      Brady Sadly it's lacking Joint Account integration.

      Reply Like
      • smarsh
      • smarsh
      • 6 mths ago
      • Reported - view

      Freitas Monzo have confirmed to me in a support email that joint account integrations with IFTTT aren’t yet available. No timescales given. 

      Reply Like
      • Freitas
      • Violet_Captain
      • 6 mths ago
      • Reported - view

      smarsh I've just signed up to the tool from Scott Robertson and it worked brilliantly with Joint Account! Happy days! I'll happily pay the fee on that one, Scott.

      Reply Like
      • smarsh
      • smarsh
      • 6 mths ago
      • Reported - view

      Freitas oh great, will take a look!

      Reply Like
Like6 Follow
  • 6 Likes
  • 6 mths agoLast active
  • 25Replies
  • 3150Views
  • 12 Following