Webhooks

Prev Next

Instances exist where duplicate webhook subscriptions are fired with the same LogEntry.event_type via LogEntry.content_type.LogEntry.action values. The two known duplicate webhook callbacks are: message.create and accountapplication.update. Please contact support@narmi.com with any questions.

A webhook is a method for automating the delivery of real-time data or notifications from one web application to another. It functions as an HTTP callback or endpoint, enabling one application to send data to a specific URL or endpoint in another application when a predefined event or trigger occurs. When one of the events is triggered, we'll send a HTTP POST payload to the webhook's configured URL. Once created, a webhook subscription will be triggered each time one or more subscribed events occur.

To receive webhooks, you need to create an endpoint on your web server that will accept a POST request with a content type of application/json.

Webhooks are sent asynchronously and are not guaranteed to be delivered in order. We recommend that applications protect against duplicated and out-of-order events by making event processing idempotent. Transmission failures, variations in latency, and other network issues mean that even though webhooks are sent to the endpoint roughly ordered, there are no guarantees that they’ll be received that way.

Events

When configuring a webhook subscription, you can choose which events you would like to receive payloads for.

For a list of available event types, go to User History Actions.

Other event types are being added regularly. Contact support@narmi.com if you require an event that is not listed above.

Retries and Endpoint Response Status Codes

When your application receives a webhook, it should respond in a timely manner with a HTTP 2xx status code to indicate successful receipt. If your webhook endpoint has complex or lengthly logic to perform, we recommend immediately returning a 2xx to let us know that you don't want to receive this event again, and then performing that logic afterwards. This should aid in preventing unwanted retry attempts caused by unexpected network timeouts.

HTTP status Retried
2xx no
3xx no
4xx yes
410 no
5xx yes
Timed Out yes

A failed event is retried up to 10 times (with an increasing timeout period in between each retry). If the event fails all 10 retries, it is discarded.

Availability

A subscription attempts to send one notification to your application per applicable event. If webhooks become unavailable for a period of time, notifications that would have been sent during that period may be sent, even at a later time.

Payloads

All event payloads are "skinny" - they include the ID of the user who performed the action as well as some event-specific information including a payload_id which is the ID of the object that was acted on. Once an event is received, an API request to retrieve the full objects must be made - this is to force synchronous API authentication. The appropriate resource to fetch can be determined by examining the event and payload ID.

Payloads are a JSON object with the following attributes:

Name Type Description
type string name of event which occurred, ie resource.create
user_id string Opaque unique identifier of the user which triggered the event
resource_id string Opaque unique identifier of the object which was acted on. Corresponds to a Narmi UUID
api_version string API version which rendered the payload
created_at string ISO 8601 timestamp at which the action occurred

Please contact support@narmi.com for additional information.

Delivery Headers

HTTP POST payloads that are delivered to your webhook's configured URL endpoint will contain several special headers:

Header Description
Content-Type application/json
X-Event-Id A unique identifier for the request, will be the same regardless of the delivery attempt number.
X-Signature-Digest The signature similar to how requests to the API must be signed.

The above can be expected on every webhook payload.

Securing Webhooks

To validate a webhook we suggest verifying the webhook payloads with the X-Signature-Digest header (which we pass with every webhook).

Validating Notifications

Signatures are computed following the draft specification on HTTP request signing and are sent in the X-Signature-Digest header.

To calculate the signature, concatenate the following, one per line, in this order, each written as name: value with a lowercase name:

  • Date header (an ISO 8601 timestamp, used exactly as received)

  • (request-target) pseudo header: post followed by the path of the subscription URL, without the query string

  • Content-Type header (always application/json)

  • Content-Length header (the length of the request body)

  • Host: the hostname of the subscription URL, without the port

For example, the canonical string for a webhook sent to https://example.com/webhooks/narmi looks like this:

date: 2026-10-21T14:30:00Z
(request-target): post /webhooks/narmi
content-type: application/json
content-length: 187
host: example.com

After that, compute the signature as an HMAC-SHA256 of the concatenated data, using the secret for that subscription as the key. The secret can be obtained in the response from the different subscription endpoints. Finally, we encode the calculated hash in Base64.

The following Python example shows how to verify a webhook signature:

import base64
import hashlib
import hmac
from urllib.parse import urlsplit

def verify_narmi_webhook(headers, body, subscription_url, secret):
    """Return True if the webhook's X-Signature-Digest header is valid.

    headers: dict of request headers
    body: raw request body as bytes
    subscription_url: the URL configured for the webhook subscription
    secret: the subscription's secret
    """
    url = urlsplit(subscription_url)
    canonical_string = "\n".join([
        f"date: {headers['Date']}",
        f"(request-target): post {url.path}",
        f"content-type: {headers['Content-Type']}",
        f"content-length: {len(body)}",
        f"host: {url.hostname}",
    ])
    signature = hmac.new(
        secret.encode("utf-8"),
        canonical_string.encode("utf-8"),
        hashlib.sha256,
    ).digest()
    expected = base64.b64encode(signature).decode("utf-8")
    return hmac.compare_digest(expected, headers["X-Signature-Digest"])

SSL / TLS

A webhook must be an HTTPS URL to ensure all data being sent to and from your server is encrypted. You need to make sure that you're using a fully chained certificate, or else the request will never make it to your server, and the attempt will fail.