Webhooks
registerWebhookEndpoint
Section titled “registerWebhookEndpoint”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.
listWebhookEndpoints
Section titled “listWebhookEndpoints”Doesn’t include secrets.
GET /v1/webhooks/endpoints · Scope: read
listWebhookEndpoints(options?): Promise<WebhookEndpointDto[]>disableWebhookEndpoint
Section titled “disableWebhookEndpoint”POST /v1/webhooks/endpoints/:id/disable · Scope: admin
disableWebhookEndpoint(id: string, options?): Promise<WebhookEndpointDto>enableWebhookEndpoint
Section titled “enableWebhookEndpoint”POST /v1/webhooks/endpoints/:id/enable · Scope: admin
enableWebhookEndpoint(id: string, options?): Promise<WebhookEndpointDto>rotateWebhookSecret
Section titled “rotateWebhookSecret”Returns a new secret. Not idempotent.
POST /v1/webhooks/endpoints/:id/rotate-secret · Scope: admin
rotateWebhookSecret(id: string, options?): Promise<WebhookEndpointWithSecretDto>listWebhookDeliveries
Section titled “listWebhookDeliveries”GET /v1/webhooks/deliveries · Scope: read
listWebhookDeliveries(options?): Promise<WebhookDeliveryDto[]>Each delivery has id, endpointId, eventType, status, attemptCount, nextAttemptAt, lastResponseStatus, lastError, createdAt and updatedAt.
replayWebhookDelivery
Section titled “replayWebhookDelivery”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>constructWebhookEvent
Section titled “constructWebhookEvent”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): WebhookEventPass the exact raw body, not re-serialized JSON. See Webhook events.
verifyWebhookSignature
Section titled “verifyWebhookSignature”Checks a signature without parsing the body.
verifyWebhookSignature(rawBody: string, signature: string, secret: string): boolean
