Webhooks
Rather than constantly polling for updates, Webhooks allow your application to receive immediate updates as users interact with Templates and Documents. To receive Webhook calls, you must provide an endpoint within your app reachable via an HTTPS `POST` call. When enabled, your endpoint will be called once per event.
To enable Webhooks, visit your [Organization Settings](https://verdocs.com/v/admin/) panel in the Verdocs Dashboard and open Developer Settings. Here you can configure your Webhook endpoint and the events you wish to receive:
All Webhooks bodies will follow this base schema:
interface IWebhookPayload {
// The event that triggered the call
event: string;
// The ID of the user who triggered the event
profile_id: string;
// The ID of the organization the event occurred in
organization_id: string;
// All dates will be in ISO9601 format
event_date: string;
// Additional data related to the event
data: Record<string, any>;
}
Each event type has a different event data
structure. For instance, when a Template is created, the payload will provide helpful metadata for the event such as the Template ID, name, etc:
const requestBody = {
event: 'template_created',
profile_id: 'f1f6d276-4347-40b0-9e53-67e02b7754ab',
organization_id: '9ce7094b-c343-4cdf-afd0-08fea50e3b26',
event_date: '2021-05-05T03:16:26.926Z',
data: {
id: '23b407e2-e473-4fb0-b3fc-838c5ee05c13',
counter: 0,
created_at: '2021-05-05T03:16:26.921Z',
updated_at: '2021-05-05T03:16:26.921Z',
is_public: false,
sender: 'creator',
name: 'Agreement 1',
is_personal: true,
organization_id: '9ce7094b-c343-4cdf-afd0-08fea50e3b26',
profile_id: 'f1f6d276-4347-40b0-9e53-67e02b7754ab',
token: '43a0721ffedc6efb84e052622d52923e256c4c89',
reminder_id: null,
description: null,
};