Receive webhooks
Mountaya sends your server a signed webhook event for each change in your organization. constructWebhookEvent checks the signature and hands you the event, typed by its type.
Pass the raw body, the Mountaya-Signature header and your endpoint's secret:
Read the body before any JSON parser does: a body parsed and written out again no longer matches its signature. Verify webhook signatures explains the scheme.
Switch on event.type, and data narrows to what that type carries:
An event can arrive twice, and in any order. Store what you act on keyed by event.id, and answer 200 within 10 seconds, before any slow work.
A type added after your release arrives with that type, and reaches the default of your switch. Acknowledge it, and do nothing:
Rotate an endpoint's secret in the Mountaya app, under Organization → Webhooks. For up to 7 days, each delivery carries a signature for the old secret and the new one, and either verifies. Deploy the new secret in MOUNTAYA_WEBHOOK_SECRET before the overlap ends.
If a secret leaked, rotate it with no overlap. Every earlier secret stops at once.
Run the contract's published test vectors through your receiver's verification, with now pinned to each vector's time:
The five cases cover a valid delivery, both secrets of a rotation, a tampered body and a replay.
To send a real test event to your endpoint, use the Mountaya app or postOrganizationWebhookDelivery.