Webhooks are a way for your add-on to respond to events and triggers in real-time without the user directly interacting with the add-on UI itself. They can be used to integrate your add-on with Clockify in a seamless way.
Webhook messages are automatically sent by Clockify whenever an event that the add-on has subscribed to is triggered. Clockify provides a variety of Webhook Event types that an add-on can subscribe to according to its needs.
There are different types of webhooks that your add-on can subscribe to. The webhooks that are available for your add-on depend on the specific version of the manifest schema that you choose.
Generally, the following webhooks are available to add-ons:
You can test and visualize how the webhooks work and their respective payloads by triggering and listening for the events on your development environment.
Webhook requests are POST
requests that are sent to notify the add-on of events it has subscribed to.
Each specific event will contain its specific payload as well as an accompanying signature that can be used to verify the request.
After installing an add-on, you can view a list of all the registered webhooks by navigating to the add-ons tab and clicking on the webhooks option.
A list of all the registered webhooks along with their endpoints will be displayed.
You can access a webhook's logs by clicking on the webhook event. The logs will contain information such as the timestamp when the request was made, the HTTP status as well as the request and response bodies.
Webhook logs are deleted after 7 days.
Each webhook that is dispatched by Clockify will contain a signature that can be used to verify its authenticity. A typical webhook request will contain the following request headers:
The webhook token supplied as part of the clockify-signature
headers does not expire.
It contains the following claims that can be used to verify its authenticity and determine its context:
clockify
addon
There are a couple of precautions that we must take to verify a webhook's authenticity and prevent request spoofing.
The JWT token must be verified and the issuer and the sub claims must match the expected values for our add-on. To learn more about the tokens, visit the Authentication & Authorization section.
You must assert that the webhook types and the payloads supplied with the request match the webhook types that you expect for each endpoint.
When an add-on which has defined an installed lifecycle gets installed on a workspace, an installation payload is provided along with the installed
event.
If the add-on has defined webhooks in its manifest, the payload will contain information regarding registered webhooks as well as the webhook token for each of them.
It is recommended that add-ons retrieve and store the authToken
for each registered webhook, so that it can later be used to verify the authenticity of the requests.
The webhook token does not expire, and the same token registered for a particular webhook will be sent as part of the clockify-signature
header for every webhook event of that type that is triggered on the workspace.