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, in the Narrative app or through the API.
For background on how webhooks work and when to use them, see Webhooks. For complete API details, see the Webhooks API Reference.

Prerequisites

  • To use the API, an API key with Webhooks read and write permissions
  • An HTTPS endpoint ready to receive POST requests
  • Familiarity with job types and job states

What you’ll learn

  • How to create a webhook subscription in the app
  • How to create a job webhook subscription with filters through the API
  • How to receive and verify webhook events
  • How to list, inspect, and archive subscriptions

Managing subscriptions in the app

Open Settings and, under Infrastructure, select Webhooks. The page lists your company’s active subscriptions with each one’s name, URL, type, and status.
1

Start a subscription

Click New Subscription.
2

Describe the subscription

Choose a Type:
  • Jobs — sends job state changes. Under Job filters, set Job types, Job IDs, and States. An event is sent for a job that matches every filter you set, and an empty filter matches any value.
  • App — passes on the events one of your company’s installed apps sends to Narrative. Choose the App.
Enter the URL that receives events. It must use https and follow the URL rules the API applies. Name is optional.
3

Create it and copy the secret

Click Create. The subscription’s details open, with its Secret masked beside a copy button. Store the secret where your handler can verify deliveries with it.
To see a subscription’s filters and secret later, open its row’s actions menu and select View. To stop deliveries, click Archive in its details, or select it from the row’s actions menu, and confirm. As in the API, archiving can’t be undone.

Creating a job webhook subscription through the API

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. The one exception: if your URL’s host resolves to an address outside the public internet when the event is sent, the event fails at once and isn’t retried. 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 through the API

List all subscriptions

Returns an array of your company’s active webhook subscriptions. Archived subscriptions are not returned.

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 keys for webhook access