Server-to-Server Hooks
Webhook Notifications & Signatures
Server-to-server HTTP notifications for connection and channel lifecycle events.
Supported Webhook Event Types
connection.createdTriggered when a new WebSocket client completes the handshakeconnection.closedTriggered when a client disconnects or times outchannel.createdTriggered when a channel transitions from empty to occupiedchannel.vacatedTriggered when the last subscriber leaves a channelmessage.publishedTriggered when an event is published to a channelHMAC-SHA256 Signature Verification
Every webhook POST includes an X-Pusher-Signature header generated using your secret key:
const crypto = require("crypto");
function verifyWebhook(rawPayload, signatureHeader, webhookSecret) {
const expected = crypto
.createHmac("sha256", webhookSecret)
.update(rawPayload)
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(signatureHeader),
Buffer.from(expected)
);
}