PynathPynath

Webhooks Integration Guide

Webhooks allow your application to automatically receive real-time HTTP POST notifications whenever an appointment is created, rescheduled, or cancelled.

1. Registering an Endpoint

In your Pynath Booking dashboard under Settings Developer Webhooks, click Add Endpoint. Enter your public HTTPS URL (e.g. https://api.yourdomain.com/webhooks/pynath) and select the event topics you wish to subscribe to.

2. Event Signature Verification (HMAC SHA-256)

Each webhook request sent by Pynath includes an X-Pynath-Signature header. Verify this header using your secret key to ensure the request genuinely originated from Pynath:

import crypto from 'crypto';

function verifyWebhookSignature(payload, signatureHeader, secretKey) {
  const hmac = crypto
    .createHmac('sha256', secretKey)
    .update(payload, 'utf8')
    .digest('hex');
    
  return crypto.timingSafeEqual(Buffer.from(hmac), Buffer.from(signatureHeader));
}

3. Sample Event Payload Envelope

{
  "id": "evt_98a72b3c4d5e",
  "event": "booking.created",
  "createdAt": "2026-08-04T07:45:00Z",
  "payload": {
    "id": "bk_716a29b4",
    "serviceId": "srv_haircut_pro",
    "serviceName": "Executive Haircut & Style",
    "customerName": "Michael Scott",
    "customerEmail": "[email protected]",
    "customerPhone": "+1 555-0199",
    "startTime": "2026-08-05T14:00:00Z",
    "endTime": "2026-08-05T14:45:00Z",
    "status": "CONFIRMED",
    "totalAmount": 1200,
    "currency": "INR"
  }
}