Getting started
A technical guide on using webhooks in Closelink.
General introduction to webhooks
Authentication
The Closelink webhook API also uses API keys for authentication of its management endpoints, you can use the same API key as for the public API.
How webhooks work in Closelink
A webhook in Closelink defines a subscription to events for certain resources in closelink. Whenever an event occurs that matches the webhook definition, a payload will be sent to the configured url via a post-request.
We also allow limiting the webhook to certain customers using a list of ids.
Specifically, the following fields are used to define a webhook:
Name of the webhook
ID of the company group
CustomerIds for which the webhook should be triggered
Url that should be called when the webhook is triggered
List of resources that should trigger the webhook on change
Enabled state of the webhook
Webhook payload
The payload sent to the webhook url contains information about the event that triggered the webhook, information about what changed (in the changes
field) as well as the resource that was changed (data
).
The data
field can have a different type depending on the resource type, see the resourceType
field for the type of resource.
Example for an ENQUIRY
event:
Enquiry model
The type of action that triggered this webhook
The type of resource the event belongs to
When the event was thrown
When the webhook was sent
Unique identifier for this webhook
Headers
The following headers are sent with every webhook execution:
Unique id of the exact webhook execution
The resource type of the event
HMAC signature of the payload using the webhook secret
How to create a webhook in the Closelink webapp
- Log in to Closelink as a group admin
- Go to the company group settings
- Scroll down to the webhooks section and click
Add destination
- Select the desired resources and companies
- Copy and save the generated secret; you can use this combined with the signature header to verify the payload
- Now you can test the webhook by creating an event in Closelink that matches the webhook definition, and it should call your endpoint
How to create a webhook using the api
Simply call the POST /v1/webhooks
endpoint with the desired data. Try it here:
Testing
For testing we recommend using a tool like webhook.site to get a temporary url to use as a webhook destination.
Full reference
You can find the full reference here. This includes the management endpoints here and the webhook events here.
You can use the Try it out
button to test the webhooks.