Blog ·Tutorial·March 2025

Building a UK Planning Application Alert System with Webhooks

How to set up real-time notifications so your application — or Slack, or email — gets alerted the moment a new planning application matches your criteria.

Updated 5 November 2026. Examples checked against the deployed PlanWire API contract. Output fixtures are fictional and do not establish current council coverage.

Planning alerts are a capture-and-recovery workflow

The UK planning API returns source-linked records and can deliver captured changes to a paid subscription. A webhook is an observation of data PlanWire captured, not a guarantee that every council publication has been captured or proof of when construction starts.

Register the smallest useful subscription

This request creates a live subscription if you run it. Choose your own public HTTPS receiver first; the .invalid URL below is intentionally non-routable. Developer subscriptions are geographically scoped; national monitoring requires Production or higher. Store the returned secret privately.

Registration template · replace the receiver before running

curl --fail-with-body --max-time 15 'https://api.planwire.io/v1/webhooks' \
  -H "X-API-Key: $PLANWIRE_KEY" -H 'Content-Type: application/json' \
  --data '{"url":"https://receiver.example.invalid/planwire","filters":{"postcodePrefix":"N16"}}'

Supported filters are councilId, postcodePrefix, status and applicationType. A keyword or radius is not a webhook filter. See subscription scope and current limits. A rejected registration is not an empty subscription.

Verify the signature before parsing the body

Read the original bytes. X-PlanWire-Signature contains sha256= followed by the HMAC-SHA256 hex digest. Reformatting JSON before verification changes the signed bytes.

Node.js signature.mjs · no dependencies

import { createHmac, timingSafeEqual } from 'node:crypto';
export function verifySignature(rawBody, header, secret) {
  if (!secret || typeof header !== 'string' || !/^sha256=[a-f0-9]{64}$/.test(header)) return false;
  const actual = Buffer.from(header.slice(7), 'hex');
  const expected = createHmac('sha256', secret).update(rawBody).digest();
  return actual.length === expected.length && timingSafeEqual(actual, expected);
}

Call verifySignature(rawBody, request.headers['x-planwire-signature'], secret) before JSON.parse. Reject an invalid signature. Set body-size and request-time limits at your receiver. The downloadable examples test valid, malformed, altered-body and wrong-secret cases offline.

Read data, deduplicate and acknowledge durably

This is a synthetic durable push payload. The record is in data, not application; source fields can be absent or null.

Synthetic durable application.new event

{
  "id": "00000000-0000-4000-8000-000000000002",
  "event": "application.new",
  "timestamp": "2026-11-05T12:00:00.000Z",
  "changedFields": [
    "reference",
    "status"
  ],
  "data": {
    "id": "00000000-0000-4000-8000-000000000001",
    "councilId": "example-council",
    "reference": "DEMO/2026/0001",
    "url": "https://example.invalid/planning/DEMO-2026-0001",
    "address": "1 Example Street, London",
    "postcode": "N16 0AA",
    "description": "Fictional single-storey rear extension for API demonstration.",
    "applicationType": "Full",
    "status": "Pending consideration",
    "decision": null,
    "decisionOutcome": "unknown",
    "receivedDate": "2026-11-02",
    "validatedDate": "2026-11-03",
    "decisionDate": null,
    "documents": []
  },
  "historicalDiscovery": false,
  "cursor": "123"
}

For durable events, persist id and payload in one transaction before returning 2xx. Repeated IDs should return 2xx without repeating downstream work. Queue your own notifications after durable storage; do not make a slow external service part of the acknowledgement path. Legacy and test events can lack the durable id/cursor: handle them explicitly rather than assuming a delivery is a new application.

Recover after downtime without skipping events

Read-only recovery request

curl --fail-with-body --max-time 15 \
  'https://api.planwire.io/v1/webhooks/WEBHOOK_ID/events?after=0&limit=100' \
  -H "X-API-Key: $PLANWIRE_KEY"

The recovery response has data[].payload, data[].cursor, delivery status and attempt metadata, plus meta.nextCursor and meta.hasMore. In one local transaction, store all page events and its nextCursor; request the next page only after that transaction commits. Never use a pushed cursor as your recovery checkpoint because pushes may arrive out of order. /missed is attempt history, not the ordered recovery stream. Recovery covers committed events since durable capture began, not all historical changes.

Failures to design for

Keep subscription identity and recovery cursor when changing your own receiver infrastructure. Do not assume a PATCH endpoint exists or delete/recreate a subscription as an editing step: that can break event continuity. Review status and date semantics, council freshness and the API evaluation page before depending on alerts.

Start building

Free sandbox for API shape. Webhooks are available on paid plans.

Get an API key →