The webhook object and the allowed CRUD operations on the related resource endpoint
Webhooks are used to send real-time events to external listeners and can be managed via API or using the related back-office app in the Hub section of the admin dashboard.
When a webhook is triggered, Commerce Layer sends a
POSTrequest to the webhook's
callback_urland the related event callback is created. The request contains a JSON payload in the same format that you get when fetching the same resource through the REST API. For each resource, you can also configure the related resources that should be included in the request body (listed in the
The endpoint listening for webhooks has 5 seconds to respond with a
200) response code, acknowledging a successful delivery. If the request times out or gets a response with a status code other than
2xx, it is considered failed.
Each webhook has a
closedby default) that can become
openonce the number of consecutive failures exceeds the specified threshold, in such case no further calls to the failing callback are made. You can check the number of consecutive failures recorded by the circuit breaker associated with a webhook by inspecting the
circuit_failure_countattribute. The counter will be reset on the first successful call to the callback URL. You can force the circuit's reset (to the
closedstate and zero failures count) by updating the webhook with the trigger attribute