Webhook ile Banka Ekstresi İşleme — Asenkron Fintech Entegrasyonu
Webhook ile Banka Ekstresi İşleme
Büyük PDF dosyaları veya yüksek hacimli iş akışları için asenkron işleme şarttır. Webhook entegrasyonu sayesinde PDF gönderip işlem tamamlandığında otomatik bildirim alabilirsiniz.
Webhook Nasıl Çalışır?
1. PDF'i webhook URL'i ile gönderin
2. API işlemeye alır ve hemen 202 Accepted döner
3. İşlem tamamlandığında webhook URL'inize POST isteği gönderilir
4. Sunucunuz sonucu işler (DB'ye kaydet, bildirim gönder, vb.)
Python Flask ile Webhook Sunucusu
from flask import Flask, request, jsonify
import requests
app = Flask(__name__)
def pdf_gonder(pdf_yolu: str, webhook_url: str, api_key: str):
resp = requests.post(
"https://api.bank-statement-parser.clkr.work/extract",
headers={
"X-Api-Key": api_key,
"X-Webhook-Url": webhook_url
},
files={"file": open(pdf_yolu, "rb")}
)
return resp.json()
@app.route("/webhook/banka-ekstresi", methods=["POST"])
def ekstresi_al():
data = request.json
islemler = data.get("transactions", [])
format_key = data.get("bankKey", "bilinmeyen")
print(f"✓ {format_key}: {len(islemler)} işlem alındı")
for islem in islemler:
kaydet(islem)
return jsonify({"ok": True})
def kaydet(islem: dict):
print(f" {islem['date']} | {islem['description'][:40]} | {islem['amount']:.2f}")
if __name__ == "__main__":
result = pdf_gonder(
"ekstre.pdf",
"https://your-app.com/webhook/banka-ekstresi",
"pex_your_key"
)
print("Kuyruğa alındı:", result)
app.run(port=5000)
Node.js Express ile Webhook
const express = require('express');
const FormData = require('form-data');
const fs = require('fs');
const fetch = require('node-fetch');
const app = express();
app.use(express.json());
async function pdfGonder(dosyaYolu, webhookUrl, apiKey) {
const form = new FormData();
form.append('file', fs.createReadStream(dosyaYolu));
const resp = await fetch('https://api.bank-statement-parser.clkr.work/extract', {
method: 'POST',
headers: {
'X-Api-Key': apiKey,
'X-Webhook-Url': webhookUrl,
...form.getHeaders()
},
body: form
});
return resp.json();
}
app.post('/webhook/banka-ekstresi', (req, res) => {
const { bankKey, transactions, pageCount } = req.body;
console.log(✓ ${bankKey}: ${transactions.length} işlem, ${pageCount} sayfa);
transactions.forEach(t => {
console.log( ${t.date} | ${t.description.slice(0, 40)} | ${t.amount});
});
res.json({ ok: true });
});
app.listen(3001, async () => {
console.log('Webhook sunucusu 3001 portunda dinliyor');
const result = await pdfGonder(
'ekstre.pdf',
'https://your-app.com/webhook/banka-ekstresi',
'pex_your_key'
);
console.log('PDF kuyruğa alındı:', result);
});
Webhook Payload Formatı
{
"bankKey": "format_v1",
"pageCount": 3,
"transactionCount": 47,
"transactions": [
{
"date": "2026-05-01",
"description": "PAYMENT",
"amount": -245.90,
"balance": 12450.10
}
]
}
Ücretsiz Başlayın
[Hesap Oluştur →](https://bank-statement-parser.clkr.work/tr/kayit) — Aylık 100 sayfa ücretsiz.