Skip to main content
Webhook subscriptions let you receive HTTP POST notifications when jobs change state, eliminating the need to poll the jobs API. This guide walks through creating, receiving, and managing webhook subscriptions.
For background on how webhooks work and when to use them, see Webhooks. For complete API details, see the Webhooks API Reference.

Prerequisites

What you’ll learn

  • How to create a job webhook subscription with filters
  • How to receive and verify webhook events
  • How to list, inspect, and archive subscriptions

Creating a job webhook subscription

Use the POST /webhooks endpoint to create a subscription. Set the type to webhook_subscription_jobs and provide your endpoint URL.

Receiving events

When a job matches your subscription’s filters, Narrative sends an HTTP POST to your URL with a JSON payload. The request carries Content-Type: application/json and an X-Narrative-Secret header.

Verify the request

Compare the X-Narrative-Secret header against the secret you stored when you created the subscription. Reject anything that does not match — that request did not come from Narrative.

Example event payload

Every delivery has the same four-field envelope. type tells you what data contains.
Return any 2xx status code to acknowledge receipt. Anything else — including a connection failure — is treated as a failed attempt and retried with exponential backoff until the event’s attempt budget runs out. For the full delivery payload schema and the list of type values, see Webhook Event Reference.

Handling idempotency

Each delivery envelope carries an id field. Retries of the same event reuse this id, so use it to make your handler idempotent.
  1. When you receive an event, check if you’ve already processed that envelope id.
  2. If yes, return 200 OK without processing again.
  3. If no, process the event and store the id.

Managing subscriptions

List all subscriptions

Returns an array of all webhook subscriptions for your company, including both active and archived subscriptions.

Get a specific subscription

Archive a subscription

Archiving stops event delivery but retains the subscription record.
Archiving is permanent — there is no way to reactivate an archived subscription. Create a new subscription if you need to resume notifications.

Best practices


Webhooks

How webhooks work and when to use them

Webhook Event Reference

Complete field reference for subscription requests and responses

Tracking Job Status

Poll-based alternative for monitoring job progress

API Keys

Create and manage API tokens for webhook access