Skip to content

Webhooks

Returns the secret, which you can’t read again. Not idempotent.

POST /v1/webhooks/endpoints · Scope: admin

registerWebhookEndpoint(request: RegisterWebhookEndpointRequest, options?): Promise<WebhookEndpointWithSecretDto>
Parameter Type Description
url string Required. An http or https URL.
description string

Returns id, organizationId, url, description, status, createdAt, updatedAt and secret.

Doesn’t include secrets.

GET /v1/webhooks/endpoints · Scope: read

listWebhookEndpoints(options?): Promise<WebhookEndpointDto[]>

POST /v1/webhooks/endpoints/:id/disable · Scope: admin

disableWebhookEndpoint(id: string, options?): Promise<WebhookEndpointDto>

POST /v1/webhooks/endpoints/:id/enable · Scope: admin

enableWebhookEndpoint(id: string, options?): Promise<WebhookEndpointDto>

Returns a new secret. Not idempotent.

POST /v1/webhooks/endpoints/:id/rotate-secret · Scope: admin

rotateWebhookSecret(id: string, options?): Promise<WebhookEndpointWithSecretDto>

GET /v1/webhooks/deliveries · Scope: read

listWebhookDeliveries(options?): Promise<WebhookDeliveryDto[]>

Each delivery has id, endpointId, eventType, status, attemptCount, nextAttemptAt, lastResponseStatus, lastError, createdAt and updatedAt.

Re-queues a dead-lettered delivery with the same event ID.

POST /v1/webhooks/deliveries/:id/replay · Scope: admin

replayWebhookDelivery(id: string, options?): Promise<WebhookDeliveryDto>

Verifies the signature and returns the typed event. Use this on your receiver. Throws OctaSdkError if the signature is missing or wrong.

constructWebhookEvent(rawBody: string, signature: string | undefined, secret: string): WebhookEvent

Pass the exact raw body, not re-serialized JSON. See Webhook events.

Checks a signature without parsing the body.

verifyWebhookSignature(rawBody: string, signature: string, secret: string): boolean