This is a simple Go application that sweeps the balance of your account at the time of receiving a deposit above a set threshold to a designated savings pot. This is a great way of automating your monthly savings and compliments the coin jar rounding up functionality already provided by Monzo.
This is designed to be run on Heroku as I already use Heroku and this runs quite happily in the free micro dyno. It's probably not that hard to modify it for AWS Lambda or any other FaaS service provider.
- Monzo triggers a webhook on each transaction.
- This webhook is configured to
POST
the transaction data to this application running on Heroku. - The application checks if the the amount is larger than the configured threshold, and if it is, it'll transfer the balance at the time of receiving the incoming transaction to a nominated pot.
- A Monzo bank account
- A Monzo Bank Developer account
- A Heroku account
- If you don't have any pots configured yet, create one on the Account tab in your Monzo app.
- Deploy Monzo Sweeper to Heroku: [Snazzy button coming 🔜]
- Make a note of the application URL, this is the webhook URL you'll need to enter on Monzo when registering the webhook. If you want a custom URL, now's the time to change it.
- Browse to https://developers.monzo.com/ and sign in. This will take you to the Monzo API playground. Make a note of the Account ID and Access token values from the top of the page. If you have multiple Monzo accounts, enter
/accounts
in theGET
box and click "Send" to get a list of accounts and make a note of the ID of the account you wish to use. You'll need to replace all references to$account_id
within the Monzo API Playground with this ID. - Obtain the Pot ID for the Pot you wish to sweep your money into by:
- replacing
/accounts
with/pots
in theGET
box and clicking "Send". - scroll through the results until you find the pot and make a note of the
id
field. This is your Pot ID.
- Register a webhook by clicking "Register webhook" of the Monzo playground page and replace the
url
value in the "Request Body" field with the application URL from Heroku and click "Send". - Set the following configuration variables, either in the Heroku UI, or using the Heroku CLI:
MONZO_ACCOUNT_ID
- your account ID, taken from step 4.MONZO_ACCESS_TOKEN
- used to request transfers to savings pot, taken from step 4.MONZO_SWEEP_POT_ID
- the identifier of the target savings pot, taken from step 5.MONZO_SWEEP_THRESHOLD
- the threshold, in pence, for incoming payments to trigger a sweep. If not set, sweeping will not occur.
$ heroku config:set \
MONZO_ACCOUNT_ID="your-account-id" \
MONZO_PERSONAL_ACCESS_TOKEN="your-personal-access-token" \
MONZO_SWEEP_POT_ID="your-savings-pot-id \
MONZO_SWEEP_THRESHOLD="your-threshold-in-pence"
- Save your Heroku config vars to a
.env
file:heroku config:get -s >.env
. Don't commit this file to your repo unless you really don't like your money 😜. - Start the application:
heroku local
. - Send test requests to 0.0.0.0:5000 using something like
curl
, httpie or Postman.
Issues and pull requests are both welcome.