API Snippets
Eine Sammlung von Snippets in gängigen Tools für Beispiele mit der Kontoflux API
Last updated
const invoice = input.config(); // invoice.invoiceNumber, recordId, amount
let response = await fetch('https://api.kontoflux.io/v1/yourWorkspaceId/transactions/match?query='+encodeURI(invoice.invoiceNumber), {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': 'sk-y0ur-ap1-k3y'
},
});
let transactions = await response.json();
transactions.forEach((transaction)=>{
if(transaction.score > 0.85){ // only if the probabillity is high enough
if(Math.abs(transaction.amount) == invoice.amount){ // even the amount matches, fantastic!
return output.set("recordId", invoice.recordId);
} else {
// might notify that the amount paid is mismatching the invoice amount
}
}
});