Skip to content

Instantly share code, notes, and snippets.

@GrahamBorland
Last active June 25, 2018 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GrahamBorland/50be8fe28321616aa118230871d0cc56 to your computer and use it in GitHub Desktop.
Save GrahamBorland/50be8fe28321616aa118230871d0cc56 to your computer and use it in GitHub Desktop.
Monzo YNAB IFTTT filter code
// spending should be negative
let accountAmount = Monzo.cardPurchase.AmountInAccountCurrency;
let localAmount = Monzo.cardPurchase.AmountInLocalCurrency;
let amount = -Number(accountAmount) * 1000;
let date = Meta.currentUserTime.toISOString().substr(0, 10);
var memo = null;
if (localAmount && localAmount != accountAmount) {
memo = Monzo.cardPurchase.LocalCurrencySymbol + localAmount;
}
let transaction = {
account_id: "YOUR-ACCOUNT-ID",
date,
amount,
memo,
payee_name: Monzo.cardPurchase.MerchantName,
approved: false,
flag_color: "purple",
import_id: Monzo.cardPurchase.TransactionId
};
let body = JSON.stringify({transaction});
MakerWebhooks.makeWebRequest.setBody(body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment