Get set up
Build your receiver
What your HTTPS endpoint must do: verify, reply 2xx within 10 seconds, and handle duplicates.
Overview
Your endpoint is a plain HTTPS route that accepts JSON. To work well it should:
- Use HTTPS on a public host. Private and local network addresses are refused.
- Check the signature before trusting anything in the body.
- Reply within 10 seconds with any 2xx status. Anything else, including redirects, counts as a failure and is retried.
- Handle duplicates. Use
idplusconfirmedas the key. - Do slow work later. Save the event, reply, then process it in a background job.
Example with Express
javascript
import express from "express";
import { verifyGraySignature } from "./verify.js";
const app = express();
// Keep the raw body: the signature covers the exact bytes Gray3 sent.
app.post("/webhooks/gray3", express.raw({ type: "application/json" }), async (req, res) => {
const rawBody = req.body.toString("utf8");
const ok = verifyGraySignature(
rawBody,
req.get("x-gray-signature"),
process.env.GRAY_WEBHOOK_KEY,
);
if (!ok) return res.status(401).end();
const event = JSON.parse(rawBody);
if (event.type === "webhook.test") return res.status(200).end();
// Save first, answer fast, do the slow work in a background job.
const isNew = await saveEventOnce(event); // see "Process each event once"
res.status(200).end();
if (isNew) queue.add("gray3-event", event);
});
app.listen(3000);Test events
Test events have type: "webhook.test" and are signed like real ones. Reply with 2xx and ignore them.
json
{
"id": "whtest_9f1c2a7b4e5d",
"type": "webhook.test",
"data": { "message": "Test event from Gray3. Respond with any 2xx status." },
"createdAt": "2026-10-16T09:30:00.000Z"
}