@hocuspocus/extension-webhook
v4.0.0
Published
hocuspocus webhook extension
Readme
@hocuspocus/extension-webhook
Send HTTP webhooks for Hocuspocus document lifecycle events — document changes, connects, disconnects, and creation. Lets you integrate the collaboration backend with your own services (search indexing, audit logs, downstream data pipelines) without writing a custom extension.
Installation
npm install @hocuspocus/extension-webhookUsage
import { Server } from "@hocuspocus/server"
import { Webhook, Events } from "@hocuspocus/extension-webhook"
const server = new Server({
extensions: [
new Webhook({
url: "https://example.com/hocuspocus-webhook",
secret: "your-signing-secret",
events: [Events.onChange, Events.onConnect, Events.onDisconnect, Events.onCreate],
}),
],
})
server.listen()Requests are signed with HMAC-SHA256 using your secret, sent in the X-Hocuspocus-Signature-256 header so the receiver can verify authenticity.
onChange events are debounced (default 2000ms, max wait 10000ms) to avoid a request per keystroke — tune with the debounce and debounceMaxWait options.
Documentation
Payload shapes, signature verification, and debounce tuning: tiptap.dev/docs/hocuspocus/server/extensions/webhook.
License
MIT — see LICENSE.md.
