Webhooks
Verifying signatures
Every request carries an X-Bulutegra-Imza: sha256=<hex> header: the HMAC-SHA256 of the raw request body using your webhook signing secret. Always verify it before processing, using a constant-time comparison.
!
Compute the signature over the raw bytes, not over re-serialised JSON.
import hashlib, hmac, os
from flask import Flask, request, abort
SIR = os.environ["BULUTEGRA_WEBHOOK_SIR"].encode()
app = Flask(__name__)
@app.post("/bulutegra-webhook")
def webhook():
beklenen = "sha256=" + hmac.new(SIR, request.get_data(), hashlib.sha256).hexdigest()
if not hmac.compare_digest(beklenen, request.headers.get("X-Bulutegra-Imza", "")):
abort(401)
olay = request.get_json()
# olay["kimlik"] ile tekrarları ayıklayın, işi kuyruğa atın
return "", 204import crypto from "node:crypto";
import express from "express";
const SIR = process.env.BULUTEGRA_WEBHOOK_SIR;
const app = express();
app.post("/bulutegra-webhook", express.raw({ type: "application/json" }), (req, res) => {
const beklenen = "sha256=" + crypto.createHmac("sha256", SIR).update(req.body).digest("hex");
const gelen = req.get("X-Bulutegra-Imza") || "";
if (gelen.length !== beklenen.length ||
!crypto.timingSafeEqual(Buffer.from(gelen), Buffer.from(beklenen))) {
return res.sendStatus(401);
}
const olay = JSON.parse(req.body);
// olay.kimlik ile tekrarları ayıklayın, işi kuyruğa atın
res.sendStatus(204);
});<?php
$sir = getenv("BULUTEGRA_WEBHOOK_SIR");
$govde = file_get_contents("php://input");
$beklenen = "sha256=" . hash_hmac("sha256", $govde, $sir);
if (!hash_equals($beklenen, $_SERVER["HTTP_X_BULUTEGRA_IMZA"] ?? "")) {
http_response_code(401);
exit;
}
$olay = json_decode($govde, true);
http_response_code(204);Last updated: 2026-10-07