Receive and verify EVORIV webhooks in Node.js and Python
EVORIV calls your https address when a record is created or changed, a quote is accepted, a work order is planned or a work report is signed. This is how you check that a call really came from EVORIV, and what to do when your system was down.
In short
Every delivery is a POST with EVORIV-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>"> under your webhook's signing secret. Recompute the HMAC over the exact bytes you received, compare in constant time, refuse a timestamp older than five minutes and deduplicate on EVORIV-Webhook-Id. Answer with any 2xx within 8 seconds.
1. Create the webhook
A workspace admin adds one in EVORIV under Settings, Developers, or you create it through the API with a write key of an admin. The address must be https and reach a public address. Pick one to eight events; record events can be narrowed to some record types.
Events: record.created, record.updated (with the names of the changed fields), record.trashed, quote.accepted, work_order.planned, work_report.signed, work_report.sent and service_request.created.
curl -X POST https://api.evoriv.com/api/dev/v1/webhooks \
-H "Authorization: Bearer $EVORIV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "ERP sync",
"url": "https://erp.example.com/hooks/evoriv",
"events": ["record.created", "quote.accepted", "work_report.signed"],
"recordTypes": ["foundation.company"]
}'
# The answer holds "secret": "whsec_...". Store it now: it is shown once.2. What EVORIV sends
The payload holds ids and the record as the webhook's person may read it now: fields they can't read are left out and named in hiddenFields, and a record they can't see is never sent.
POST /hooks/evoriv HTTP/1.1
Content-Type: application/json
User-Agent: EVORIV-Webhooks/1
EVORIV-Webhook-Id: 0b8e4c52-... (the same on every retry)
EVORIV-Webhook-Event: record.created
EVORIV-Webhook-Timestamp: 1763640000
EVORIV-Webhook-Attempt: 1
EVORIV-Signature: t=1763640000,v1=5f2c...e91a
{
"id": "0b8e4c52-...",
"event": "record.created",
"occurredAt": "2026-11-21T09:30:00.000Z",
"apiVersion": "1",
"workspaceId": "...",
"subscriptionId": "...",
"data": {
"recordId": "6f1c2b9e-...",
"recordType": "foundation.company",
"record": { "id": "6f1c2b9e-...", "fields": { "foundation.company_name": "Bakkerij De Vries" }, "hiddenFields": [] }
}
}3. Verify in Node.js
Read the raw body before any JSON parser touches it. Use the whole secret, including whsec_, as the HMAC key.
// npm install express
import express from "express";
import { createHmac, timingSafeEqual } from "node:crypto";
const SECRET = process.env.EVORIV_WEBHOOK_SECRET; // whsec_..., the whole string
const TOLERANCE_SECONDS = 300;
const app = express();
// EVORIV signs the exact bytes it sent: read the raw body, parse it afterwards.
app.post("/hooks/evoriv", express.raw({ type: "application/json" }), async (req, res) => {
if (!verify(req.get("EVORIV-Signature"), req.body)) return res.status(400).send("invalid signature");
const delivery = JSON.parse(req.body.toString("utf8"));
if (await alreadyHandled(delivery.id)) return res.sendStatus(200); // retries repeat the id
await queue(delivery); // answer within 8 seconds; do slow work later
res.sendStatus(204);
});
export function verify(header, rawBody, now = Math.floor(Date.now() / 1000)) {
if (typeof header !== "string") return false;
const parts = Object.fromEntries(header.split(",").map((part) => {
const i = part.indexOf("=");
return [part.slice(0, i).trim(), part.slice(i + 1).trim()];
}));
const t = Number(parts.t);
if (!Number.isInteger(t) || !/^[0-9a-f]{64}$/.test(parts.v1 ?? "")) return false;
if (Math.abs(now - t) > TOLERANCE_SECONDS) return false;
const expected = createHmac("sha256", SECRET).update(`${t}.`).update(rawBody).digest();
return timingSafeEqual(expected, Buffer.from(parts.v1, "hex"));
}
// Replace these two with your database and job queue.
const seen = new Set();
async function alreadyHandled(id) { if (seen.has(id)) return true; seen.add(id); return false; }
async function queue(delivery) { console.log(delivery.event, delivery.data.recordId ?? ""); }
app.listen(3000);4. Verify in Python
# pip install flask
import hashlib, hmac, json, os, time
from flask import Flask, abort, request
SECRET = os.environ["EVORIV_WEBHOOK_SECRET"].encode() # whsec_..., the whole string
TOLERANCE_SECONDS = 300
app = Flask(__name__)
def verify(header, raw_body, now=None):
if not header:
return False
parts = dict(p.strip().split("=", 1) for p in header.split(",") if "=" in p)
try:
t = int(parts.get("t", ""))
except ValueError:
return False
if abs((now or time.time()) - t) > TOLERANCE_SECONDS:
return False
expected = hmac.new(SECRET, f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))
@app.post("/hooks/evoriv")
def evoriv_webhook():
raw = request.get_data() # the exact bytes EVORIV signed
if not verify(request.headers.get("EVORIV-Signature"), raw):
abort(400)
delivery = json.loads(raw)
# Deduplicate on delivery["id"]: it is the same on every retry.
print(delivery["event"], delivery["data"].get("recordId"))
return "", 2045. Retries, duplicates and auto-pause
- At least once: a delivery can arrive twice. EVORIV-Webhook-Id (and id in the body) is the same on every retry: deduplicate on it.
- Any 2xx answer within 8 seconds counts as delivered. Anything else, or no answer, is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 8 hours: 6 attempts in all.
- After 10 failed attempts in a row the webhook pauses itself and the audit log records it. While paused nothing is sent and events are not kept for later. Resume it in Settings or with PATCH /webhooks/{id}.
- An address EVORIV refuses (not public, not https) is not retried.
# Send a signed webhook.test event now and see what your endpoint answered
curl -X POST https://api.evoriv.com/api/dev/v1/webhooks/$WEBHOOK_ID/test -H "Authorization: Bearer $EVORIV_API_KEY"
# The newest deliveries: status, attempts and the last answer
curl "https://api.evoriv.com/api/dev/v1/webhooks/$WEBHOOK_ID/deliveries?limit=25" -H "Authorization: Bearer $EVORIV_API_KEY"
# Resume a webhook that paused itself after failures
curl -X PATCH https://api.evoriv.com/api/dev/v1/webhooks/$WEBHOOK_ID \
-H "Authorization: Bearer $EVORIV_API_KEY" -H "Content-Type: application/json" \
-d '{ "paused": false }'