Skip to content

Webhooks

Receive signed publishing outcomes at an HTTPS endpoint.

A workspace owner can register an HTTPS receiver for publishing outcomes. PubNio records the event in the same transaction as the delivery change, then sends it from the Worker. Each endpoint pins the API version at creation, currently 2026-12-02, and every delivery carries that value in the PubNio-Version header. The event body also has a version field; that is the event schema version and is separate from the API version.

Events

Event When it is recorded
post.delivery.published The provider confirmed the target.
post.delivery.provider_draft The provider saved a native draft.
post.delivery.failed The attempt reached a definitive failure.
post.delivery.unresolved PubNio cannot establish the provider outcome.
post.delivery.cancelled A caller cancelled an unreserved attempt.

The body is an immutable snapshot with a stable event ID, schema version, UTC timestamp, workspace ID, and typed data. Published and provider-draft data carry providerRef: { id, kind } and an optional url. Failed and unresolved data carry issue and nextAction, plus canRetry or canReconcile. PubNio signs the exact bytes it sends. Receivers may get duplicates, and later outcomes may arrive before earlier ones; deduplicate by event ID and apply each event to its stated attempt.

Register an endpoint

pnio webhooks create --workspace "$WORKSPACE_ID" \
  --name "Delivery events" \
  --url https://hooks.example.com/pubnio \
  --event post.delivery.published \
  --event post.delivery.failed

Save the signing secret from creation. Verify the Standard Webhooks signature against the raw request body before decoding the event. The SDK helper checks the HMAC, timestamp tolerance, and constant-time comparison, then returns the decoded event:

import { verifyWebhookSignature } from "@pubnio/sdk";

const event = await verifyWebhookSignature({
  secret: process.env.PUBNIO_WEBHOOK_SECRET,
  body: rawBody,
  headers: request.headers,
});

Respond with 2xx once the event is safely recorded. Deliveries are at least once, so deduplicate by event.id. Retries do not affect the original publishing attempt.

Replay a delivery

A workspace owner can replay a delivered, failed, or cancelled delivery. Replay resets the same delivery to pending with zero attempts and queues it for the dispatcher, so the event ID and body stay unchanged:

pnio webhooks replay-delivery --workspace "$WORKSPACE_ID" \
  --endpoint-id "$ENDPOINT_ID" --delivery-id "$DELIVERY_ID"

The API returns 202 with the updated delivery. A delivery that is already pending or sending cannot be replayed; the request returns 409 with webhook_delivery_not_replayable and a nextAction to read it again after it settles. API keys and workspace members are rejected because webhook management requires the workspace owner.

Type to search…

↑↓ navigate↵ selectEsc close