Skip to main content

Webhook management

A webhook is a URL on your server that Hovi calls when something happens in an organization, for example when a holder accepts a credential. These methods add, list and delete an organization's webhooks. The events, the payloads and how to check a webhook's signature are explained in Webhooks.

Add webhook​

Adds a webhook URL to an organization.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const webhook = await openid.addWebhook({
organizationId: '<ORGANIZATION_ID>',
webhookUrl: 'https://example.com/hovi-webhook',
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
webhookUrlstring (Required)The HTTPS URL that receives the events.

The response contains the new webhookId.

Get webhooks​

Lists an organization's webhooks.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const webhooks = await openid.getWebhooks({
organizationId: '<ORGANIZATION_ID>',
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
webhookIdstring (Optional)Return only this webhook.

Delete webhook​

Removes a webhook from an organization. Hovi stops sending events to its URL.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const result = await openid.deleteWebhook({
organizationId: '<ORGANIZATION_ID>',
webhookId: '<WEBHOOK_ID>',
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
webhookIdstring (Required)The ID of the webhook to delete.