Last active
June 25, 2018 16:14
-
-
Save GrahamBorland/50be8fe28321616aa118230871d0cc56 to your computer and use it in GitHub Desktop.
Monzo YNAB IFTTT filter code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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