akahu - v1.15.3 / WebhooksResource
Utilities for managing, retrieving, and validating webhooks.
https://developers.akahu.nz/docs/reference-webhooks
-
BaseResource
↳
WebhooksResource
▸ list(token
): Promise
<Webhook
[]>
Gets active webhooks for the user associated with the specified token
.
https://developers.akahu.nz/reference/get_webhooks
Name | Type |
---|---|
token |
string |
Promise
<Webhook
[]>
▸ subscribe(token
, webhook
, requestOptions?
): Promise
<string
>
Subscribe to a webhook.
Name | Type |
---|---|
token |
string |
webhook |
WebhookCreateParams |
requestOptions? |
PostRequestOptions |
Promise
<string
>
The newly created webhook id.
https://developers.akahu.nz/reference/post_webhooks
▸ unsubscribe(token
, webhookId
): Promise
<void
>
Unsubscribe from a previously created webhook.
https://developers.akahu.nz/reference/delete_webhooks-id
Name | Type |
---|---|
token |
string |
webhookId |
string |
Promise
<void
>
▸ listEvents(query
): Promise
<WebhookEvent
[]>
List all webhook events with the specified status in the specified date range (defaults to last 30 days).
https://developers.akahu.nz/reference/get_webhook-events
Name | Type |
---|---|
query |
WebhookEventQueryParams |
Promise
<WebhookEvent
[]>
▸ getPublicKey(keyId
): Promise
<string
>
Get a webhook signing public-key by id.
https://developers.akahu.nz/reference/get_keys-id
Name | Type |
---|---|
keyId |
string | number |
Promise
<string
>
▸ validateWebhook(keyId
, signature
, webhookRequestBody
, cacheConfig?
): Promise
<WebhookPayload
>
Helper to validate a webhook request payload.
See the project README for example usage.
throws
AkahuWebhookValidationError
if validation of the webhook fails due to invalid signature or expired signing key.
throws
AkahuErrorResponse
if the client fails to fetch the specified signing key from the Akahu API.
https://developers.akahu.nz/docs/reference-webhooks
Name | Type |
---|---|
keyId |
string | number |
signature |
string |
webhookRequestBody |
string |
cacheConfig |
Partial <WebhookCacheConfig > |
Promise
<WebhookPayload
>
The deserialized webhook payload after successful validation