Webhooks allow you to receive real-time HTTP notifications when a delivery status changes. Instead of polling the API for updates, Chidori pushes status updates directly to your server.
Webhooks are configured through the Chidori Dashboard. You can set your webhook URL and manage your signing secret from the dashboard.
Every webhook request includes a signature in the X-Webhook-Signature header. Always verify this signature to ensure the request came from Chidori.The signature format is: t={timestamp},v1={signature}
async function processStatusChange(data) { const { deliveryId, trackingId, status } = data; // Find your order by delivery ID const order = await Order.findOne({ deliveryId }); if (!order) return; // Update order status based on delivery status switch (status) { case 'ASSIGNED': await order.update({ status: 'driver_assigned' }); await notifyCustomer(order, 'Your delivery has been assigned to a driver'); break; case 'PICKED_UP': await order.update({ status: 'picked_up' }); await notifyCustomer(order, 'Your package has been picked up'); break; case 'IN_TRANSIT': await order.update({ status: 'in_transit' }); break; case 'DELIVERED': await order.update({ status: 'delivered', deliveredAt: new Date() }); await notifyCustomer(order, 'Your package has been delivered!'); break; case 'CANCELLED': await order.update({ status: 'cancelled' }); await notifyCustomer(order, 'Your delivery has been cancelled'); break; }}