Webhooks Guide
Set up webhooks to get notified when documentation changes.
1 min read122 words
Webhooks Guide #
Webhooks allow you to receive real-time notifications when events occur in OpenDocs.
Supported Events #
document.created- New document publisheddocument.updated- Document content changeddocument.deleted- Document removedsubmission.created- New submission receivedsubmission.reviewed- Submission approved/rejected
Register a Webhook #
http
POST /api/v1/webhooks
Authorization: Bearer YOURAPIKEY
Content-Type: application/json
json
{
"url": "https://your-site.com/webhook",
"events": ["document.created", "document.updated"],
"secret": "your-webhook-secret"
}
Webhook Payload #
json
{
"event": "document.created",
"timestamp": "2024-01-15T10:30:00Z",
"data": {
"id": "uuid",
"slug": "new-document",
"title": "New Document Title"
}
}
Signature Verification #
All webhooks are signed with HMAC-SHA256. Verify using:
javascript
const crypto = require("crypto");
const signature = crypto
.createHmac("sha256", secret)
.update(payload)
.digest("hex");
Compare with the X-Webhook-Signature header.