Webhooks are a way to get notified when an event happens on your blog.
cache.single
{ path: string }
cache.templates
cache.all
When an event happens, a POST request is sent to the webhook URL. The request body is a JSON object with the following properties. The content
property is the event data. See the above table for the event data structure.
{
"subdomain": "my-subdomain",
"timestamp": 1645208678,
"event": "cache.single",
"data": {}
}
In the console, you can find a key for each Webhook you create. This key is sent in each response. You can use it to verify the webhook using a simple string comparison.
if (request.post.key !== env.HB_WEBHOOK_KEY) {
return "Unauthorized";
}
Soon we will be moving to a signature-based method for verification.
We expect a 200 HTTP Response Code from your server to mark the webhook as success. If we get any other response code or fail to reach your servers, we will retry to send the webhook for 3 more times after
If all fail, we will mark that webhook as failed and will no longer send it automatically. However, you can manually trigger it from the Console later.