Receive ProductEnv events with webhooks
Webhooks send ProductEnv events, such as changed secrets, approved change requests and failed syncs, to your own endpoint, a Slack channel or a Discord channel. They are part of the Team and Business plans. Payloads never contain secret values: only key names, counts, ids and names.
Updated
- Open the project, then project settings and Webhooks. In a project with several apps, it sits under that app's settings.
- Choose New webhook, then a Destination: Webhook (a signed JSON POST to your endpoint), Slack or Discord.
- Fill in Name and URL, pick the Events, and optionally limit it to some Environments (none selected means every environment of the app, including new ones).
- Choose Create webhook. For a Webhook destination, copy the signing secret from Copy the signing secret: it is shown only once.
- Choose Send test to send a
pingevent right away.
You need the Manage webhooks permission (project owners and admins have it by default) and write access to the app. A project can have up to 10 webhooks, every app counted. The URL is stored encrypted and only shown masked afterwards.
| Event | Fields in data |
|---|---|
secret.changed | created, updated and deleted key names, their counts, source, and changeRequestId when a change request applied it |
change_request.opened | changeRequestId, number, title, and approvals / requiredApprovals where they apply |
change_request.approved | Same as change_request.opened |
change_request.rejected | Same as change_request.opened (the review note isn't sent) |
change_request.applied | Same as change_request.opened |
security_alert.opened | count and alerts (id, key, kind, severity), one event per environment |
sync.succeeded | provider, target, count and trigger |
sync.failed | provider, target, count and trigger |
environment.created | name and preview (preview environments included) |
environment.deleted | name, preview and secretsCount |
token.created | tokenId, name and access |
token.revoked | tokenId, name and access |
member.added | member, userId, role and via (sent to the webhooks of every app) |
member.removed | member, userId, role and via (sent to the webhooks of every app) |
rotation.due | count and items (key, kind, reason, dueAt) |
Lists of key names hold at most 100 entries; the counts are always exact. Send test sends a ping event whose environment is null.
A Webhook destination receives a POST with a JSON body. Every event has the same envelope; only data changes:
{
"id": "<event id>",
"event": "secret.changed",
"occurredAt": "<ISO 8601 date and time>",
"organization": { "name": "<organization>" },
"project": { "id": "<project id>", "name": "<project>", "slug": "<project slug>" },
"environment": { "id": "<environment id>", "name": "production" },
"actor": { "type": "user", "label": "<who made the change>" },
"data": {
"created": ["NEW_KEY"],
"updated": ["DATABASE_URL"],
"deleted": [],
"createdCount": 1,
"updatedCount": 1,
"deletedCount": 0,
"source": "<where the change came from>"
},
"url": "<link to the environment in the dashboard>"
}| Header | Value |
|---|---|
Content-Type | application/json |
User-Agent | ProductEnv-Webhooks/1.0 |
X-ProductEnv-Event | The event name, for example secret.changed |
X-ProductEnv-Delivery | A new id for each delivery (a redelivery gets a new one) |
X-ProductEnv-Signature | t=<unix seconds>,v1=<hex HMAC-SHA256> |
The payload's id stays the same across retries and redeliveries: use it to process each event once. Slack and Discord destinations get a formatted message with a link to ProductEnv instead, and no signature.
X-ProductEnv-Signature holds t, the time of sending in Unix seconds, and v1, the hex HMAC-SHA256 of <t>.<raw body> keyed with your full signing secret (including its whsec_ prefix). Compare it in constant time and refuse timestamps older than 5 minutes:
import crypto from "node:crypto";
import express from "express";
const app = express();
const secret = process.env.PRODUCTENV_WEBHOOK_SECRET; // whsec_…
// Keep the raw body: the signature covers the exact bytes ProductEnv sent.
app.post("/productenv", express.raw({ type: "application/json" }), (req, res) => {
const header = req.get("X-ProductEnv-Signature") ?? "";
const parts = Object.fromEntries(header.split(",").map((part) => part.split("=")));
const timestamp = Number(parts.t);
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${req.body}`)
.digest("hex");
const fresh = Math.abs(Date.now() / 1000 - timestamp) <= 300;
const valid =
typeof parts.v1 === "string" &&
parts.v1.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
if (!fresh || !valid) return res.status(400).send("Invalid signature");
const event = JSON.parse(req.body.toString("utf8"));
// event.id stays the same across retries: use it to ignore duplicates.
console.log(event.event, event.project.slug, event.data);
res.sendStatus(204);
});
app.listen(3000);To change the secret, choose Roll the signing secret. Deliveries are signed with the new secret at once, so update your endpoint right after.
- A delivery succeeds when your endpoint answers with a 2xx status within 10 seconds. Redirects are not followed.
- A failed delivery is tried 5 times in all, after 1, 5, 30 and 120 minutes.
- After 20 failed attempts in a row, the webhook turns off and the project owner is notified. Fix the endpoint, then turn it back on.
- Deliveries lists each delivery for 14 days with its status, response code and duration. Redeliver sends one again.
URLs ProductEnv accepts
Webhook URLs must use https and resolve to public IP addresses: private, loopback and cloud metadata addresses are refused. Slack URLs must be on hooks.slack.com and Discord URLs on discord.com/api/webhooks/.
Do ProductEnv webhooks include secret values?
- Never. Payloads carry key names, counts, ids, names and a dashboard link, so your endpoint or chat channel never receives a value.
What happens to webhooks when we move to the Free plan?
- They stay but are paused: no new deliveries are sent until you are on Team or Business again. You can still review their delivery logs and delete them.
Can one webhook cover every app of a project?
- No, a webhook belongs to one app. Events about people (member.added and member.removed) are sent to every app's webhooks, once per URL.