Tavolo Plus DevelopersAPI referenceConsole
Docs menu
Guide

Webhooks

Get told when something happens on a brand, also when the call came from another system of yours. Add up to 3 HTTPS endpoints per brand in the console; each gets its own signing secret.

Events

typeWhendata
purchase.createdA purchase was recorded (also when it added 0)The purchase, as POST /v1/purchases returned it
purchase.reversedA purchase was reversedThe reversal
redemption.createdA reward or points were redeemedThe redemption
pingYou pressed Send test event in the console{ message }

A retried call with the same reference sends nothing new. Deleting a customer sends no event.

What we send

POST /your/webhook/url
Content-Type: application/json
User-Agent: TavoloPlus-Webhooks/1.0
Tavolo-Signature: t=1761748325,v1=5f0c3a…

{
  "id": "evt_3b8f0c2a9d1e4f5a6b7c8d9e",
  "type": "purchase.created",
  "created": "2026-10-29T14:32:05.311Z",
  "livemode": false,
  "data": {
    "id": "pur_7a1c9e2b4d6f8a0b1c2d3e4f",
    "customerRef": "user_8841",
    "programme": "stamps",
    "stamps": { "added": 1, "count": 6, "required": 10, "rewardReady": false },
    "createdAt": "2026-10-29T14:32:05.120Z"
  }
}

Delivery

  • Answer any 2xx within 5 seconds. Anything else (3xx included: redirects are not followed) is a failure. Do the work after answering.
  • At least once and unordered: the same event can arrive twice (and a replay keeps its id). Dedupe on id.
  • A failed delivery is retried, waiting 1 min, 5 min, 30 min, 2 h, 5 h, then 10 h between attempts, with a last attempt 24 h after the event. Then it is marked failed.
  • An endpoint that fails every delivery for 24 hours is disabled and we email you. Fix it, enable it in the console, and replay what you need from the delivery log (kept 30 days).
  • Only public HTTPS addresses are accepted: no localhost, private ranges or plain HTTP.

Verify the signature

Tavolo-Signature is t=<unix seconds>,v1=<hex>, where the hex is HMAC-SHA256 of t + "." + the raw body with the endpoint's secret. Accept the event when any v1 matches and t is within 5 minutes. Compute it over the raw bytes: parsing and re-encoding the JSON changes them.

Verify Tavolo-Signature
const crypto = require("crypto");

// rawBody: the request body exactly as received (a string or Buffer), not re-encoded JSON.
function verifyTavoloSignature(rawBody, header, secret, toleranceSeconds = 300) {
  const parts = String(header || "").split(",");
  const t = Number((parts.find((p) => p.startsWith("t=")) || "").slice(2));
  if (!Number.isInteger(t) || t <= 0 || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest();
  return parts
    .filter((p) => p.startsWith("v1="))
    .some((p) => {
      const given = Buffer.from(p.slice(3), "hex");
      return given.length === expected.length && crypto.timingSafeEqual(given, expected);
    });
}

// Express: keep the raw body for this route.
// app.post("/tavolo/webhooks", express.raw({ type: "application/json" }), (req, res) => {
//   if (!verifyTavoloSignature(req.body, req.get("Tavolo-Signature"), process.env.TAVOLO_WEBHOOK_SECRET))
//     return res.sendStatus(400);
//   const event = JSON.parse(req.body);
//   res.sendStatus(200); // answer fast, then process (dedupe on event.id)
// });

Rotating the secret

Rotate in the console: the new secret signs at once and the old one keeps signing too (a second v1) for 24 hours. Deploy the new secret within that day.