Für Entwickler
Webhooks empfangen
Empfangen Sie PODFY-Ereignisse auf Ihrem eigenen Server und prüfen Sie, dass jede Anfrage echt ist: Signatur, Wiederholungen und Codebeispiele.
Was ein Webhook hier ist
Ein Webhook ist eine Anfrage, die PODFY an Ihren Server sendet, sobald etwas passiert: Ein Liefernachweis oder eine Meldung geht ein, ein Bearbeitungsstatus ändert sich oder eine Erstattung wird freigegeben. Sie müssen die API nicht ständig abfragen. Jede Anfrage ist signiert, sodass Ihr Server prüfen kann, dass sie wirklich von PODFY kommt und unterwegs nicht verändert wurde.
Diese Seite zeigt, wie Sie Webhooks empfangen. Die Ereignisse und der Aufbau des Bodys stehen in der Referenz weiter unten, auf Englisch wie die API-Referenz. Die REST-API ist in der API-Referenz beschrieben.
Webhook einrichten und testen
Ein Administrator Ihrer Marke legt einen Webhook im Portal (das auf Englisch ist) unter Settings → Integrations → Webhooks an, mit Add webhook. Tragen Sie die HTTPS-Adresse Ihres Empfängers ein und wählen Sie die Ereignisse. Das Geheimnis, mit dem PODFY signiert, wird nur einmal angezeigt, speichern Sie es daher in Ihrer Geheimnisverwaltung. Mit New secret erzeugen Sie ein neues Geheimnis: Das alte funktioniert noch 24 Stunden, sodass Sie Ihren Empfänger umstellen können, ohne eine Anfrage zu verpassen.
Mit Send test sendet PODFY ein webhook.test-Ereignis mit den echten Headern und der echten Signatur an Ihre Adresse, damit Sie Ihre Prüfung testen können, bevor echte Ereignisse eintreffen. Das Zustellprotokoll im Portal zeigt den Antwortcode jedes Versuchs, und mit Resend senden Sie eine Zustellung erneut.
Haben Sie noch keinen Empfänger, bitten Sie den PODFY-Support um eine Test-Inbox. Sie nimmt die signierten Anfragen an und zeigt, was angekommen ist. Ein Webhook erhält je nach QA-Einstellung entweder Produktivdatensätze oder nur Testdatensätze von qa.podfy.app.
Wohin PODFY sendet
PODFY sendet nur an HTTPS-Adressen mit öffentlichem Hostnamen auf Port 443. IP-Adressen, Adressen mit Benutzername oder Passwort, Hosts von PODFY selbst sowie Hosts unter workers.dev oder pages.dev werden beim Speichern abgelehnt. PODFY folgt keinen Weiterleitungen: Tragen Sie daher die endgültige Adresse ein.
Ein Webhook kann auch GET mit einer eigenen Query-Zeichenfolge verwenden (benutzerdefinierte Payload). Die Signatur deckt dann die vollständige URL ab, siehe Referenz.
Referenz
Webhooks empfangen
Die Referenz weiter unten ist in jeder Sprache auf Englisch, wie die API-Referenz.
Events
A webhook subscribes to the events it lists, or to all standard events with *. * never matches the refund events: list refund.approved and refund.updated by name.
| Event | Sent when | Notes |
|---|---|---|
pod.created | A new record of a brand in delivery mode (a proof of delivery was uploaded). | |
report.created | A new record of a brand in report mode (a QR report was submitted). | |
record.status_changed | The work status of a record changed (portal, bulk change or API). | Adds change. |
record.updated | Another field of a record changed: assignee, priority or duplicate_of. One event per changed field. A comment alone sends nothing. | Adds change. |
webhook.test | A brand admin pressed Send test in the portal. | A sample or the latest record, with the real headers and signature. |
refund.approved | A refund request was approved. PODFY records and forwards the request; it never pays out. | Only when the webhook lists it by name. Adds record.refund. |
refund.updated | A refund was rejected, or its payout result (paid or failed) was recorded through the API. | Only when the webhook lists it by name. Adds record.refund. |
The request
PODFY sends a signed request to your URL for every event (POST with a JSON body, or GET for a custom webhook).
| Header | Value |
|---|---|
Podfy-Signature | t=<unix seconds>,v1=<hex>,v2=<hex>. See Verify the signature. |
Podfy-Delivery | Unique delivery id (dlv_…). Identical on every retry of the same delivery. |
Podfy-Event | The event name, as in the body. |
Content-Type | application/json for the standard payload. A custom webhook sends the content type you chose. |
User-Agent | PODFY-Webhooks/1.0 |
The payload
This is the standard body. A custom webhook sends the body you built from the template.
| Field | Type | Description |
|---|---|---|
id | string | Event id (evt_…). Use it as an idempotency key. |
version | integer | Payload format version, 1. Bumped only for a breaking change; new fields do not bump it. |
event | string | One of the events above. |
created_at | string | ISO 8601 time of the event. |
brand | string | The brand slug. |
record | object | The record: podfy_id, mode, reference, asset, category, priority, work_status, note, fields, group_id, files, location, duplicate_of, url and updated_at (time of the last change of the record). |
change | object | Only on record.status_changed and record.updated: {field, from, to}. |
record.refund | object | Only on refund.approved and refund.updated: {id, amount, currency, pay_ref, status, decided_at, result}. Use refund.id as your idempotency key. The approver's e-mail is never included. |
Example: report.created
{
"id": "evt_5d1e8a07b3c94f2a61d0e7f8",
"version": 1,
"event": "report.created",
"created_at": "2026-11-16T09:24:00Z",
"brand": "acme",
"record": {
"podfy_id": "PFY-7Q4K2-1",
"mode": "report",
"reference": "COFFEE-1",
"asset": {
"name": "Coffee machine",
"location": "Floor 2",
"group": "B"
},
"category": "NOT_WORKING",
"priority": "high",
"work_status": "new",
"note": "Makes a grinding noise",
"fields": {
"floor": "2"
},
"group_id": "PFY-7Q4K2",
"files": [
{
"name": "photo.jpg",
"url": "https://portal.podfy.net/api/public/pod/3f9a0c1d2e4b5a69/file"
}
],
"location": null,
"duplicate_of": null,
"url": "https://portal.podfy.net/pod/3f9a0c1d2e4b5a69",
"updated_at": "2026-11-16T09:24:00Z"
}
}
Verify the signature
Check every request before you trust it. You need the secret of the webhook, the Podfy-Signature and Podfy-Delivery headers and the raw request body.
- Split
Podfy-Signatureat the commas. Taketand everyv1andv2value. - Reject the request when
tis more than 5 minutes (300 seconds) away from your clock. - Compute
v2= HMAC-SHA256 (hex) with your secret oft + "." + delivery id + "." + raw body, where the delivery id is thePodfy-Deliveryheader. This is recommended: it also binds the delivery id, so a captured request cannot be replayed under another one. v1= HMAC-SHA256 (hex) oft + "." + raw body. It stays valid and is what you check when you do not use the delivery id.- Compare your value with the received one in constant time. Accept the request when any received pair matches (during a rotation there are two pairs).
- Answer with a 2xx status. A request that fails verification should get a 4xx and no further processing.
Sign the raw bytes. Parsing the JSON and serialising it again changes spacing and key order, and the signature will not match. A GET webhook has no body: the signed content is the full request URL as sent, including the query string.
Worked example
Secret, delivery id and body below are an example you can run your code against. The body is the exact string that was signed. Every character counts, so use the raw bytes you receive.
| Part | Value |
|---|---|
| Secret | whsec_0123456789abcdef0123456789abcdef0123456789abcdef |
t | 1795000000 |
Podfy-Delivery | dlv_3f9a0c1d2e4b5a69c0de |
Body
{"id":"evt_5d1e8a07b3c94f2a61d0e7f8","version":1,"event":"report.created","created_at":"2026-11-16T09:24:00Z","brand":"acme","record":{"podfy_id":"PFY-7Q4K2-1","mode":"report","reference":"COFFEE-1","asset":{"name":"Coffee machine","location":"Floor 2","group":"B"},"category":"NOT_WORKING","priority":"high","work_status":"new","note":"Makes a grinding noise","fields":{"floor":"2"},"group_id":"PFY-7Q4K2","files":[{"name":"photo.jpg","url":"https://portal.podfy.net/api/public/pod/3f9a0c1d2e4b5a69/file"}],"location":null,"duplicate_of":null,"url":"https://portal.podfy.net/pod/3f9a0c1d2e4b5a69","updated_at":"2026-11-16T09:24:00Z"}}Podfy-Signature
t=1795000000,v1=7a4613e656dc09602ed02650fc2439d25640c0e0af5e7964446ac850feb81a0d,v2=32cb0d5cef76e5d988b540c71b54aea8047766be7cc9eb761a950c0deab398a9With a rotation in progress the header holds a second v1/v2 pair made with the previous secret, for example t=…,v1=A,v2=A,v1=B,v2=B.
Code samples
Both samples use only the standard library of the language. They check the timestamp, compare in constant time, prefer v2 when the delivery id is available and accept any matching pair.
Node.js: verify.js
const crypto = require("node:crypto");
// rawBody: the request body exactly as received (Buffer), never re-serialised JSON.
// For a GET webhook pass the full request URL instead of a body.
function verifyPodfyWebhook(secret, signatureHeader, deliveryId, rawBody, nowSeconds = Math.floor(Date.now() / 1000)) {
let t = null;
const v1 = [];
const v2 = [];
for (const part of String(signatureHeader || "").split(",")) {
const i = part.indexOf("=");
if (i < 1) continue;
const key = part.slice(0, i).trim();
const value = part.slice(i + 1).trim();
if (key === "t") t = value;
else if (key === "v1") v1.push(value);
else if (key === "v2") v2.push(value);
}
const timestamp = Number(t);
if (!t || !Number.isFinite(timestamp)) return false;
if (Math.abs(nowSeconds - timestamp) > 300) return false; // older (or newer) than 5 minutes
const body = Buffer.isBuffer(rawBody) ? rawBody : Buffer.from(String(rawBody), "utf8");
const sign = (prefix) =>
crypto.createHmac("sha256", secret).update(prefix).update(body).digest("hex");
const equal = (a, b) =>
a.length === b.length && crypto.timingSafeEqual(Buffer.from(a), Buffer.from(b));
// v2 also binds the delivery id (recommended). During a secret rotation the header holds two pairs:
// accept the request when any of them matches.
if (deliveryId && v2.length) {
const expected = sign(`${t}.${deliveryId}.`);
return v2.some((candidate) => equal(expected, candidate));
}
const expected = sign(`${t}.`);
return v1.some((candidate) => equal(expected, candidate));
}
module.exports = { verifyPodfyWebhook };
Node.js: a receiver
const http = require("node:http");
const { verifyPodfyWebhook } = require("./verify");
const secret = process.env.PODFY_WEBHOOK_SECRET;
const seen = new Set(); // use a database or cache with an expiry in production
http.createServer((req, res) => {
const chunks = [];
req.on("data", (chunk) => chunks.push(chunk));
req.on("end", () => {
const rawBody = Buffer.concat(chunks);
const ok = verifyPodfyWebhook(secret, req.headers["podfy-signature"], req.headers["podfy-delivery"], rawBody);
if (!ok) { res.writeHead(400).end(); return; }
res.writeHead(200).end("ok"); // answer within 10 seconds, then process
const event = JSON.parse(rawBody.toString("utf8"));
if (seen.has(event.id)) return; // a retry of an event you already handled
seen.add(event.id);
console.log(event.event, event.record.podfy_id);
});
}).listen(3000);
Python: verify.py
import hashlib
import hmac
import time
def verify_podfy_webhook(secret, signature_header, delivery_id, raw_body, now=None):
"""raw_body: the request body as bytes, exactly as received (for a GET webhook: the full URL as bytes)."""
t, v1, v2 = None, [], []
for part in (signature_header or "").split(","):
key, _, value = part.strip().partition("=")
if key == "t":
t = value
elif key == "v1":
v1.append(value)
elif key == "v2":
v2.append(value)
try:
timestamp = int(t)
except (TypeError, ValueError):
return False
if abs((time.time() if now is None else now) - timestamp) > 300: # older (or newer) than 5 minutes
return False
def sign(prefix):
return hmac.new(secret.encode(), prefix.encode() + raw_body, hashlib.sha256).hexdigest()
# v2 also binds the delivery id (recommended). During a secret rotation the header holds two pairs:
# accept the request when any of them matches.
if delivery_id and v2:
expected, candidates = sign(f"{t}.{delivery_id}."), v2
else:
expected, candidates = sign(f"{t}."), v1
return any(hmac.compare_digest(expected, c) for c in candidates)
Python: a receiver
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import os
SECRET = os.environ["PODFY_WEBHOOK_SECRET"]
seen = set() # use a database or cache with an expiry in production
class Handler(BaseHTTPRequestHandler):
def do_POST(self):
raw_body = self.rfile.read(int(self.headers.get("Content-Length", 0)))
ok = verify_podfy_webhook(SECRET, self.headers.get("Podfy-Signature"), self.headers.get("Podfy-Delivery"), raw_body)
self.send_response(200 if ok else 400)
self.end_headers()
if not ok:
return
event = json.loads(raw_body) # answered first in real code: queue the work
if event["id"] in seen: # a retry of an event you already handled
return
seen.add(event["id"])
print(event["event"], event["record"]["podfy_id"])
HTTPServer(("", 3000), Handler).serve_forever()
Secret rotation
When a brand admin creates a new secret (New secret in the portal), the previous secret stays valid for 24 hours. During that time every request carries a second v1/v2 pair signed with the previous secret. Accept the request when any pair matches: a receiver that still has the old secret and one that already has the new secret both verify. After 24 hours only the new secret signs.
Delivery, retries and idempotency
- Answer with any 2xx status within 10 seconds. Anything else, a timeout or a network error counts as a failure. Redirects are not followed. Answer first and process afterwards.
- A failed delivery is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours. After that it is marked
failed. A delivery that stayspendingis put back in the queue automatically. The delivery log in the portal shows every attempt, and Resend sends a delivery again by hand. - A delivery can arrive more than once (a retry after a timeout, or a resend). Treat the event
id(and thePodfy-Deliveryheader) as the idempotency key: store the ids you handled and ignore a repeat. For refunds userecord.refund.id. - Events of one record can arrive out of order. Use
record.updated_atto ignore an older event. - Receivers must tolerate new fields. New fields are added without a new
version; only a breaking change raisesversion. - A webhook with a custom payload sends your own body and content type. The headers and the signature are the same, and the signature covers the body as sent.
Allowed targets
- HTTPS only, on port 443, with a public host name. No IP addresses, no user name or password in the URL, no
podfy.apporpodfy.nethosts (except a PODFY test inbox address), noworkers.devorpages.dev, no local or internal host names. - The address is checked when you save the webhook. Variables of a custom payload are allowed in the query string and the body only, never in the scheme, host or path.