vDrive
vDrive API Docs
vgrubs.com

Webhooks

Every change of a delivery is sent to your URL, signed with your webhook secret.

Send your webhook URL to your vGrubs contact and we set it up. You get a webhook secret, shown once, to check that a request really comes from us.

When we send

  • On every change of a delivery: status, driver, arrival times, tracking link and the final amount. The same state is never sent twice.
  • One attempt, 10 second timeout, no retries. If you miss one, Get delivery has the latest state.
  • Answer 2xx quickly and do the work in the background.
  • The order is not guaranteed: go by updatedAt, the latest state wins.

The request

Headers
POST {your webhook URL}
Content-Type: application/json
X-VGrubs-Timestamp: 1764005471
X-VGrubs-Signature: 5f1c...e9a0
Body
{
"event": "delivery.updated",
"data": {
"id": 900,
"externalId": "order-778812",
"status": "en_route_pickup",
"provider": "grubhub",
"pickupLocation": {
"externalId": "store-1042",
"name": "Joe Pizza"
},
"driver": {
"name": "Sam K.",
"phoneNumber": "+12125550199",
"photo": "https://..."
},
"trackingUrl": "https://track.vgrubs.com/AbC123xYz0",
"pickupEta": "2026-11-24T17:42:00.000Z",
"dropoffEta": "2026-11-24T18:05:00.000Z",
"tip": 300,
"vDriveFee": 30,
"vGrubsFee": 0,
"deliveryFee": 775,
"amount": 1105,
"settled": false,
"cancellationReason": null,
"createdAt": "2026-11-24T17:20:11.000Z",
"updatedAt": "2026-11-24T17:31:40.000Z"
}
}
eventstring

The event type: delivery.updated.

dataDelivery

The delivery, as Get delivery returns it.

Checking the signature

X-VGrubs-Signature is the HMAC-SHA256 (hex) of the string <X-VGrubs-Timestamp>.<raw body>, keyed with your webhook secret. Compute it over the raw body, before you parse the JSON, and refuse requests whose timestamp is more than 5 minutes old.

const crypto = require('crypto');
const express = require('express');
function isValidVGrubsWebhook(rawBody, headers, secret) {
const timestamp = headers['x-vgrubs-timestamp'];
const signature = headers['x-vgrubs-signature'];
const expected = crypto
.createHmac('sha256', secret)
.update(`${timestamp}.${rawBody}`)
.digest('hex');
const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
if (!fresh || typeof signature !== 'string' || signature.length !== expected.length) {
return false;
}
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}
const app = express();
// express.raw: the signature covers the exact bytes we sent.
app.post('/webhooks/vgrubs', express.raw({ type: 'application/json' }), (req, res) => {
if (!isValidVGrubsWebhook(req.body, req.headers, process.env.VGRUBS_WEBHOOK_SECRET)) {
return res.sendStatus(401);
}
res.sendStatus(200);
const { data: delivery } = JSON.parse(req.body);
// Store delivery.status and delivery.updatedAt, in the background.
});
If your secret leaks, ask us for a new one. The old secret stops working at once, so switch over as soon as you get it.