Updates your ProjectionLab account balances with the latest data from Monarch Money.
- Connects to APIs: Scripts communicate with both Monarch Money and ProjectionLab's Plugin API.
- Fetches Monarch Data: Your Monarch Money account balances are directly downloaded to your machine.
- Updates ProjectionLab: The project updates your ProjectionLab account information using the
updateAccount()
Plugin API.
Here is how the API looks like:
window.projectionlabPluginAPI.updateAccount('12345', { balance: 1000 }, { key: 'YOUR_PL_API_KEY' })
In the above example, 12345
is the accountId
of your account in ProjectionLab, 1000
is the new balance and YOUR_PL_API_KEY
is the Plugin API key (see below on how to get the key).
If you have 10 accounts, you have to call this API 10 times, with the correct accountId
and balance, to update of all the accounts. And since the API uses the window
object,
you should call this API from the browser's developer console.
See the image below:
When you run the script (in step 5 below), it generates a string that you can copy and paste into the browser's developer console. Your account data is downloaded directly from Monarch Money to your local machine and then the script will update the account balances in ProjectionLab.
- Your Monarch Money account credentials
- Basic familiarity with your browser's developer console
Since this will modify ProjectionLab's application data, it's better to do a backup (Account Settings > Export Data), so you have something to restore from if needed.
- Login to ProjectionLab and go to Account Settings on the top right.
- Open Plugins page -> (Account Settings > Plugins)
- Enable the switch 'Enable Plugins'.
- Copy the value in the text box 'Plugin API Key'. (From now on, this key will be referred to as
YOUR_PL_API_KEY
.)
ℹ️ You need to do this step only once ℹ️
The goal of this step is to get the accountId
of the accounts in ProjectionLab that you want to update. To help you do that, this step lists all accounts in ProjectionLab with their accountId
and name
.
- Open the Developer Console of your browser and run the following script that gives you the
id
andname
of the accounts.
YOUR_PL_API_KEY
with the key that you copied in step 1.4 above
const exportData = await window.projectionlabPluginAPI.exportData({ key: 'YOUR_PL_API_KEY' });
// Merge the list of savings accounts, investment accounts, assets and debts
const plAccounts = [...exportData.today.savingsAccounts, ...exportData.today.investmentAccounts,
...exportData.today.assets, ...exportData.today.debts];
plAccounts.forEach(account => {
console.log(account.id, account.name)
});
- The browser console will display the id and name of your accounts in ProjectionLab.
- Copy the list of
account.id
andaccount.name
of those accounts.
ℹ️ You need to do this step only once ℹ️
- Open the file 'config.js' and replace
monarch_email
andmonarch_password
with your Monarch credentials.- If you have configured Multi-Factor Authentication, you will need to update
monarch_mfa
with the mfa code. - Note - this is not the recovery code, but the 30+ character code that is shown right next to the QR code when you set up MFA.
- You might have to re-enable MFA if you don't have the code with you.
- If you have configured Multi-Factor Authentication, you will need to update
- Open terminal and install the node packages by running
npm install
. - Run
node get-monarch-accounts.js
in the terminal. - The terminal will display the list of Monarch accounts with their
id
andname
. - Copy the list of the
id
s of the accounts you want to import.
ℹ️️ You need to do this step only once ℹ️️
- Open the file 'config.js'
- Replace
YOUR_PL_API_KEY
with the key that you copied in step 1.4 above. - Update the
accountMapping
array with the correspondingid
s of Monarch accounts and ProjectLab accounts - Monarch id inmonarchAccountID
and ProjectionLabs id inplAccountID
.
- Run
node index.js
to get the script that you can use in ProjectionLab. - Copy the script from the terminal output
- Open browser's developer console of the ProjectionLab browser and paste the above script and hit Enter
The accounts in the ProjectionLab will be updated with the new values. Congratulations! You did it! Each time you want to update the account balances in ProjectionLab, you only need to run step 5.
Contributions are welcome!