Webhooks
Mit Webhooks kann man über bestimmte Ereignisse in Propstack benachrichtigt werden, wie z.B. wenn ein Objekt aktualisiert wird.
Last updated
{
"id": 123
}{
"hooks": [
{
"id": 10,
"event": "CLIENT_CREATED",
"target_url": "https://propstack-immobilien.de/ps-hook"
}
]
}{
"ok": true
}const crypto = require('crypto');
function verifySignature(requestBody, signature, secret) {
const hash = crypto
.createHmac('sha256', secret)
.update(requestBody, 'utf8')
.digest('hex');
return hash === signature;
}function verify_signature($requestBody, $signature, $secret) {
$hash = hash_hmac('sha256', $requestBody, $secret);
return hash_equals($hash, $signature);
}
// Usage example within a WordPress context
$requestBody = file_get_contents('php://input');
$providedSignature = $_SERVER['HTTP_X_PROPSTACK_SIGNATURE'];
$secret = 'your_secret_key';
if (verify_signature($requestBody, $providedSignature, $secret)) {
// The request is verified
} else {
// The request could not be verified
}