Skip to main content

Webhooks

Delhivery sends real-time shipment status updates to a URL you configure in the developer portal. The SDK provides TypeScript types for the webhook payload so you can type your handler safely.

Setup

  1. Log in to the Delhivery One portal.
  2. Navigate to Webhook Settings.
  3. Enter your publicly accessible URL (e.g. https://yourapp.com/webhooks/delhivery).
  4. Save and test.

Payload type

import type { WebhookEvent } from "delhivery-sdk";
FieldTypeDescription
waybillstringShipment waybill
statusstringCurrent status
Status DateTimestringTimestamp
CitystringCity of scan
Scan TypestringScan category
ScanstringScan description
ReferenceNostring | undefinedYour client order ID
Instructionsstring | undefinedCourier instructions

Express handler example

import express from "express";
import type { WebhookEvent } from "delhivery-sdk";

const app = express();
app.use(express.json());

app.post("/webhooks/delhivery", (req, res) => {
const events: WebhookEvent[] = Array.isArray(req.body)
? req.body
: [req.body];

for (const event of events) {
console.log(`[${event.waybill}] ${event.status} @ ${event["Status DateTime"]}`);

if (event.status === "Delivered") {
// mark order as delivered in your DB
}
if (event["Scan Type"] === "NDR") {
// handle non-delivery report
}
}

res.sendStatus(200);
});

Common status values

StatusMeaning
ManifestedOrder created, not yet picked up
In TransitShipment is moving
Out for DeliveryCourier is delivering today
DeliveredSuccessfully delivered
RTO InitiatedReturn to origin started
RTO DeliveredReturned to warehouse
LostShipment lost
NDRNon-delivery report raised