Skip to main content
๐Ÿ””โš™๏ธ๐Ÿ“กguidesSource: opendocs-core

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 published
  • document.updated - Document content changed
  • document.deleted - Document removed
  • submission.created - New submission received
  • submission.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.