Custom webhooks
Custom webhooks post booking events as JSON to URLs you choose. For the Shopify webhooks Rentshelf receives, see Webhooks & data.
Add an endpoint
Section titled “Add an endpoint”- Open Rentshelf → Settings → Custom webhooks.
- Under Add an endpoint, enter a public
https://Endpoint URL. Private, local and internal addresses are rejected and redirects are not followed. - Optionally add a Description.
- Choose the events, then select Add endpoint.
- Copy the Signing secret right away. It is shown once; use Rotate secret to create a new one.
- Select Send test event to check your receiver.
A store can have up to 10 endpoints. Each endpoint can be edited, disabled, enabled or deleted.
Events
Section titled “Events”| Event | Sent when |
|---|---|
booking.created | A rental is booked (paid checkout, manual booking or API). |
booking.updated | Dates, units or details change, or the booking is rescheduled. |
booking.cancelled | A booking is cancelled. |
booking.picked_up | The customer picks up the rental (status becomes active). |
booking.returned | The rental is returned. |
booking.overdue | An active rental passed its return date without being returned. |
Send test event sends a ping event.
Request format
Section titled “Request format”Each delivery is a POST with Content-Type: application/json and these headers:
Rentshelf-Signature—t=<unix seconds>,v1=<signature>Rentshelf-Event— the event nameRentshelf-Delivery— the delivery ID
The body contains an id (a stable evt_... event ID), type, created_at, shop and data.object with the booking. Status events also include data.previous_status. The full booking fields are in the API reference.
Verify the signature
Section titled “Verify the signature”v1 is the hex HMAC-SHA256 of <timestamp>.<raw body> using the signing secret. Reject requests whose timestamp is more than 5 minutes old. Node.js example:
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyRentshelf(rawBody, header, secret) { const parts = Object.fromEntries( (header || "").split(",").map((p) => { const i = p.indexOf("="); return [p.slice(0, i).trim(), p.slice(i + 1).trim()]; }), ); const timestamp = Number(parts.t); if (!Number.isInteger(timestamp) || !parts.v1) return false; if (Math.abs(Date.now() / 1000 - timestamp) > 300) return false; const expected = createHmac("sha256", secret) .update(`${timestamp}.${rawBody}`, "utf8") .digest("hex"); const a = Buffer.from(expected); const b = Buffer.from(parts.v1); return a.length === b.length && timingSafeEqual(a, b);}Use the raw request body, not re-serialized JSON.
Retries and the delivery log
Section titled “Retries and the delivery log”Respond with a 2xx status within 10 seconds. A failed delivery is retried up to 6 attempts in total, after about 1 minute, 5 minutes, 30 minutes, 2 hours and 8 hours. Deliveries can arrive more than once or out of order, so deduplicate on the event id.
After 25 consecutive failed deliveries, the endpoint is disabled automatically. Fix the receiver and select Enable. The Delivery log shows the latest 50 deliveries with status, attempts, HTTP status and the last error.