Docs menu

Webhooks

A webhook tells your server what happened, so it never has to ask.

Set a public https address under Developers → Webhook. We send a POST with a JSON body whenever one of these events happens. The signing secret starts with whsec_ and is shown once.

Events

EventWhen
lead.createdA lead is added by a call, a chat, an import, the dashboard or the API.
call.completedA call ends. Includes the outcome, the length and the transcript.
appointment.bookedThe employee books an appointment on a call or a chat.
campaign.completedEveryone in a campaign has been tried.

A webhook.test event is sent when you press “Send a test”.

The message

{
  "id": "b7d1c2e49a0f4a77",
  "event": "call.completed",
  "createdAt": 1794135684,
  "data": {
    "call": {
      "id": "51d8c2e07a9b4f63",
      "direction": "out",
      "phone": "+919848012345",
      "answered": true,
      "startedAt": 1794135600,
      "endedAt": 1794135684,
      "seconds": 84,
      "billedSeconds": 90,
      "outcome": "completed",
      "campaignId": null,
      "leadId": "9f3c0a1b2c3d4e5f",
      "transcript": [
        {
          "speaker": "agent",
          "text": "Hello Ravi, this is a reminder for tomorrow at 11 am.",
          "at": 1794135603
        },
        {
          "speaker": "person",
          "text": "Yes, I will come.",
          "at": 1794135611
        }
      ]
    }
  }
}

These headers come with it: X-NavaPrastha-Event, X-NavaPrastha-Delivery (the same as the message id) and X-NavaPrastha-Signature.

Check the signature

The signature header looks like t=1794135684,v1=ab12.... The value after v1= is the HMAC-SHA256, in hex, of t + "." + the raw body, made with your signing secret. Check it on the raw body before you parse it, compare in constant time and reject a t older than 5 minutes.

import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
  const want = createHmac("sha256", secret).update(parts.t + "." + rawBody).digest("hex");
  const a = Buffer.from(want), b = Buffer.from(parts.v1 || "");
  return a.length === b.length && timingSafeEqual(a, b);
}
import hmac, hashlib, time

def verify(raw_body: bytes, header: str, secret: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    if abs(time.time() - int(parts["t"])) > 300:
        return False
    want = hmac.new(secret.encode(), parts["t"].encode() + b"." + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(want, parts.get("v1", ""))

Retries

Answer with any 2xx status within 10 seconds. If you do not, we try again after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours, which is 6 tries in all, and then stop. A failed delivery can be retried from the delivery log in Developers. Each message has a unique id: if you see the same one twice, ignore the second.

Good to know

  • You can have one webhook address for your account.
  • You can make a new signing secret at any time. The old one stops working at once, so update your server first.

Last updated 13 November 2026. Found something wrong on this page? Email bodavulasiddardha@navaprastha.in and we will correct it.