Pottr/Docs
Topic:Webhooks & Event Dispatching
Build & Integrate
.md

Webhooks & Event Dispatching

Subscribing to collection data changes with HMAC-SHA256 signature verification.

Supported Events

  • entry.created: Triggered when a new entry is created via POST.
  • entry.updated: Triggered when an entry is updated via PUT or PATCH.
  • entry.deleted: Triggered when an entry is soft-deleted via DELETE.
  • *: Wildcard event triggering on all three operations.

Managing Webhooks

Webhooks are managed via REST routes requiring the Secret Key (sk_live_...):

MethodEndpointDescription
GET/webhooksList all registered webhooks.
POST/webhooksRegister a new webhook (url, event, optional collection). Returns signing secret.
DELETE/webhooks/{id}Delete a webhook subscription by ID.
GET/webhooks/{id}Fetch one webhook.
PUT/webhooks/{id}Update the url, event, collection or active flag.
POST/webhooks/{id}/regenerate-secretIssue a new signing secret. The old one stops working immediately.
POST/webhooks/{id}/testSend a test ping and return latency and status. Pro and Business only.

Webhook Payload Structure

Webhook JSON Payload
{
  "event": "entry.created",
  "timestamp": 1714999999,
  "payload": {
    "collection": "tasks",
    "entry": {
      "id": "42",
      "title": "Deploy update",
      "created_at": "2026-05-06 12:00:00"
    }
  }
}

Signature Verification (HMAC-SHA256)

Every delivery includes an X-Pottr-Signature header containing sha256=<hex_hash>. Compute the HMAC using the raw request body and your webhook secret:

verify-webhook.js (Node.js)
const crypto = require('crypto');

function verifyPottrWebhook(rawBodyBuffer, signatureHeader, secret) {
  const expectedSignature = 'sha256=' + crypto
    .createHmac('sha256', secret)
    .update(rawBodyBuffer)
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(signatureHeader),
    Buffer.from(expectedSignature)
  );
}

Security & Delivery Rules

  • HTTPS Destination Required: Webhook URLs must use https://.
  • SSRF Protections: Localhost, loopback IPs (127.0.0.1), private subnets (10.0.0.0/8, 192.168.0.0/16), and raw IP addresses are rejected.
  • Background Delivery: Deliveries are sent by WP-Cron after the API response, so they never slow down your requests. Each attempt has a 5-second timeout, so acknowledge with 2xx immediately and do the work afterwards. (Sites that disable WP-Cron deliver inline.)
  • Delivery Log: Every attempt is logged with its response. Any non-2xx response is recorded as failed. Pottr does not retry failed deliveries, so make your endpoint idempotent and use the log to investigate.
  • Retention: Delivery history is kept for your plan’s log retention period.
  • Plan Limits: Free allows 1 webhook, Pro 10, Business unlimited.