Skip to main content

Overview

The webhooks sub-client lets you create, list, and delete webhook endpoints. When events occur (e.g. a grant is created or revoked), Grantex sends an HTTP POST to your registered URLs with a signed payload.

webhooks.create()

Create a new webhook endpoint. The response includes a secret for verifying payload signatures — store it securely, as it is only returned once.

Parameters

string
required
The HTTPS URL to receive webhook events.
WebhookEventType[]
required
The events to subscribe to.

Event types

Response: WebhookEndpointWithSecret

string
Unique webhook endpoint identifier.
string
The registered URL.
WebhookEventType[]
The subscribed event types.
string
The HMAC signing secret. Only returned on creation.
string
ISO 8601 creation timestamp.

webhooks.list()

List all webhook endpoints for your organization.

Response: ListWebhooksResponse

WebhookEndpoint[]
Array of webhook endpoint objects (without secrets).

webhooks.delete()

Delete a webhook endpoint.

Parameters

string
required
The webhook endpoint ID to delete.

Response

Returns void.

Verifying webhook signatures

The SDK exports a verifyWebhookSignature() function to verify that incoming webhook payloads were sent by Grantex. The function uses HMAC-SHA256 with timing-safe comparison.

Import

Usage

Parameters

string | Buffer
required
The raw request body as received from Grantex.
string
required
The value of the X-Grantex-Signature header.
string
required
The webhook secret returned when the endpoint was created.

Response

Returns true if the signature is valid, false otherwise.
Always use the raw request body for verification. Parsing the JSON before verifying will change the byte representation and cause signature mismatches.
Last modified on February 28, 2026