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
readandwritepermissions - 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.
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.
Creating a job webhook subscription through the API
Use thePOST /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 carriesContent-Type: application/json and an X-Narrative-Secret header.
Verify the request
Compare theX-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.
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 anid field. Retries of the same event reuse this id, so use it to make your handler idempotent.
- When you receive an event, check if you’ve already processed that envelope
id. - If yes, return
200 OKwithout processing again. - If no, process the event and store the
id.
Managing subscriptions through the API
List all subscriptions
Get a specific subscription
Archive a subscription
Archiving stops event delivery but retains the subscription record.Best practices
Related content
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

