Webhooks
Receive contact.created, card.created, card.phase_changed, and message.received as HMAC-SHA256 signed POSTs, with retries, a delivery log, and resend.
Webhooks tell your system when something happens in the CRM, without polling. You subscribe an
HTTPS URL to one or more events and Perpetuus sends it a signed POST every time one occurs.
Create subscriptions on the Settings → Webhooks page (ADMIN role) or with
POST /webhook-subscriptions, using a session JWT, an API key
(ppt_…), or an OAuth token. The connectors (Zapier, Make, n8n) use the same routes as REST Hooks.
Events (v1)
| Event | When | Credential scope |
|---|---|---|
contact.created | A contact is created | crm:read |
card.created | A card is created on a board | crm:read |
card.phase_changed | A card moves to another phase | crm:read |
message.received | A customer message arrives in a conversation | chat:read |
With boardId, the subscription only receives card and message events tied to that board. The
filter does not apply to contact.created. The shape of each data object is available from
GET /webhook-subscriptions/samples?event=…, which returns a static
example (never real data).
Delivery format
POST /your-endpoint HTTP/1.1
Content-Type: application/json
User-Agent: Perpetuus-Webhooks/1.0
X-Perpetuus-Event: card.phase_changed
X-Perpetuus-Delivery: dlv_6f1c2a4e-1b7d-4c55-9a0e-3f2b8d7c1e90
X-Perpetuus-Timestamp: 1795178400
X-Perpetuus-Signature: sha256=5d41402abc4b2a76b9719d911017c592...{
"id": "evt_2b7f0c1e-4d3a-4f8e-9c21-7a6b5d4e3f10",
"type": "card.phase_changed",
"version": "1",
"timestamp": "2026-11-20T12:40:00.000Z",
"tenant": { "organizationId": "hq9zn02ochcnlsxeb2ysdai9", "slug": "acme" },
"data": {
"documentId": "cd1a2b3c4d5e6f7g8h9i0j1k",
"title": "Proposta — Acme Ltda",
"board": { "documentId": "bd1a2b3c4d5e6f7g8h9i0j1k", "name": "Vendas" },
"fromPhase": { "documentId": "ph0a1b2c3d4e5f6g7h8i9j0k", "name": "Novo lead" },
"toPhase": { "documentId": "ph1a2b3c4d5e6f7g8h9i0j1k", "name": "Qualificação" },
"fields": { "origem": "site" }
}
}id(evt_…) identifies the event: it stays the same across retries and resends. Use it to deduplicate.X-Perpetuus-Delivery(dlv_…) identifies the delivery: it stays the same across retries and changes on a manual resend.- Bodies over 256 KB arrive with
datareduced to a reference ({ "truncated": true, "documentId": …, "board": …, "url": … }). Fetch the resource from the API. - Redirects (
3xx) are not followed.
Verifying the signature
The signature is sha256= followed by the hex HMAC-SHA256 of
{X-Perpetuus-Timestamp}.{raw body}, keyed with the subscription secret (whsec_…).
- Read the raw body (bytes) before any JSON parsing.
- Recompute the HMAC and compare in constant time.
- Reject timestamps more than 5 minutes away from your clock (replay protection).
The secret is shown only once: on creation and on each rotation. Store it like a password. If it
leaks, rotate it on Settings → Webhooks or with
POST /webhook-subscriptions/{id}/rotate-secret: the old one stops working immediately.
Node.js
import crypto from 'node:crypto';
import express from 'express';
const app = express();
const SECRET = process.env.PERPETUUS_WEBHOOK_SECRET; // whsec_…
app.post('/webhooks/perpetuus', express.raw({ type: 'application/json' }), (req, res) => {
const ts = req.header('X-Perpetuus-Timestamp') ?? '';
const received = req.header('X-Perpetuus-Signature') ?? '';
const expected =
'sha256=' + crypto.createHmac('sha256', SECRET).update(`${ts}.${req.body}`).digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(ts)) < 300;
const valid =
received.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
if (!fresh || !valid) return res.status(401).end();
const event = JSON.parse(req.body.toString('utf8'));
// deduplicate by event.id and process asynchronously
res.status(200).end();
});Python
import hashlib, hmac, os, time
from flask import Flask, request, abort
app = Flask(__name__)
SECRET = os.environ["PERPETUUS_WEBHOOK_SECRET"].encode() # whsec_…
@app.post("/webhooks/perpetuus")
def perpetuus_webhook():
ts = request.headers.get("X-Perpetuus-Timestamp", "")
received = request.headers.get("X-Perpetuus-Signature", "")
body = request.get_data() # raw bytes
expected = "sha256=" + hmac.new(SECRET, f"{ts}.".encode() + body, hashlib.sha256).hexdigest()
if not ts.isdigit() or abs(time.time() - int(ts)) > 300:
abort(401)
if not hmac.compare_digest(received, expected):
abort(401)
event = request.get_json()
# deduplicate by event["id"] and process asynchronously
return "", 200Responses, retries, and auto-pause
Respond 2xx within 10 seconds and process the event afterwards (queue, job). What Perpetuus does with each response:
| Response | Result |
|---|---|
2xx | Delivered |
429, 5xx, timeout, or network error | Retried |
410 Gone | The subscription is deleted and its pending deliveries are cancelled |
Other 4xx and 3xx | Failed, not retried |
Each delivery gets up to 8 attempts within a 24-hour window, counted from the event: immediately, then after ~1 min, ~6 min, ~21 min, ~1h21, ~5h21, ~17h21, and 24h. A receiver that is down for a few minutes still gets everything.
After 10 consecutive deliveries that failed for good (all attempts used), the subscription is
paused (status: "paused", pausedReason starting with auto:). Fix the receiver and
reactivate it on the page or with PATCH /webhook-subscriptions/{id} and {"status": "active"}.
Events that happen while it is paused are not delivered later.
Delivery is at least once: in rare cases (a timeout after your server already processed the
request), the same event arrives again. Deduplicate by id. Ordering across different events is
not guaranteed; use timestamp and the resource data.
Testing, the log, and resending
- Test:
POST /webhook-subscriptions/{id}/testsends apingright away (or an event's example, withdata.test: true) and returns the HTTP status, latency, and the start of the response. Tests do not count toward auto-pause. - Log:
GET /webhook-subscriptions/{id}/deliverieslists the last 30 days of deliveries, with attempts, HTTP status, latency, and the first 500 characters of the response. - Resend:
POST /webhook-subscriptions/{id}/deliveries/{deliveryId}/resendresends the same event (sameid) with a newX-Perpetuus-Deliveryand anX-Perpetuus-Resend-Ofheader with the original delivery, signed with the current secret.
Accepted URLs
https://only (up to 2048 characters), with no username or password in the URL.- Private, loopback, link-local, CGNAT, and cloud-metadata addresses are rejected, on creation and on every send, including when a public domain resolves to them.
localhostand.local,.internal,.localhost, and.home.arpadomains are rejected.
To test locally, use a public HTTPS tunnel (ngrok, Cloudflare Tunnel) or a service such as webhook.site.
Limits
| Item | Limit |
|---|---|
| Subscriptions per organization | 50 |
| Receiver response time | 10 s |
| Attempts per delivery | 8 (24-hour window) |
| Body size | 256 KB (above that, data becomes a reference) |
| Delivery log retention | 30 days |