Real-time HTTP POST notifications for integrity and alignment trace events — pipe violations, drift, conscience escalations, trace verification, and billing events into your ops stack.
Real-time HTTP POST notifications for integrity and alignment events. Pipe violations, drift alerts, conscience escalations, alignment traces, and billing events into PagerDuty, Slack, Datadog, or any HTTP endpoint.Instead of polling the API, configure webhook endpoints to receive events as they happen. Mnemom signs every payload with HMAC-SHA256 so your server can verify authenticity before acting on it.Mnemom emits two categories of webhook events:
Integrity Events (AIP) — real-time checkpoint verdicts from the gateway (violations, drift, conscience)
Alignment Trace Events (AAP) — post-hoc trace analysis from the observer (verification, escalation, policy)
Both use the same registration endpoint and table. A single webhook endpoint can subscribe to events from both systems.
Copy
Ask AI
AIP Checkpoint ──→ Gateway ──→ Signed POST (X-AIP-Signature) ──→ Your EndpointAAP Trace ──→ Observer ──→ Signed POST (X-AAP-Signature) ──→ Your Endpoint │ ├── PagerDuty ├── Slack ├── Datadog └── Custom handler
Webhook notifications are available on the Enterprise plan. Contact sales to enable this feature.
This example subscribes to AIP integrity violations, drift alerts, and AAP trace failures — all at one endpoint.2. Copy the signing secret from the response — it’s shown only once:
Mnemom emits 28 event types across two systems: AIP (integrity checkpoints from the gateway) and AAP (alignment traces from the observer), plus platform events for drift, reputation, teams, and billing.
These events fire from the observer after post-hoc trace analysis.
Event Type
Description
Trigger
trace.created
New alignment trace recorded
Every trace submitted to Supabase
trace.verified
Trace passed verification checks
verification.verified === true
trace.failed
Trace failed verification checks
verification.verified === false
trace.escalation_required
Escalation condition detected
trace.escalation.required === true
policy.violation
Policy evaluation resulted in denial
policyResult.verdict === 'fail'
AAP webhook payloads are signed with X-AAP-Signature and include X-AAP-Version. Use the trace.* wildcard to subscribe to all trace events, or * for everything.
A single registration can subscribe to both AIP and AAP events. For example, event_types: ["integrity.violation", "trace.failed"] will receive gateway violations and observer trace failures at the same endpoint. The signature header (X-AIP-Signature vs X-AAP-Signature) tells you which system sent the event.
AAP trace events use a different payload structure from AIP events. The envelope includes event (most specific event type), all_events (all applicable types for this trace), and a trace object with verification and policy results.
AAP events are signed with X-AAP-Signature (not X-AIP-Signature). The HMAC-SHA256 algorithm is identical — only the header name differs. Use the header name to distinguish which system sent the webhook.
Every webhook delivery includes three headers for signature verification:
Header
Description
X-Webhook-Id
Unique event ID (same as payload.id)
X-Webhook-Timestamp
Unix timestamp (seconds) when the payload was signed
X-Webhook-Signature
HMAC-SHA256 signature in format v1={hex}
The signature is computed over the string {timestamp}.{raw_body} using your endpoint’s signing secret as the HMAC key. This follows the Stripe webhook signing convention.
Always verify that the timestamp is within an acceptable window (recommended: 5 minutes) to prevent replay attacks. Reject any delivery where X-Webhook-Timestamp is more than 300 seconds from your server’s current time.
Use a constant-time comparison function when verifying signatures to prevent timing attacks. All standard libraries provide one — see the verification examples below.
Verify webhook signatures in your endpoint handler to ensure payloads are authentic and untampered. Below are examples in four languages.
Copy
Ask AI
const crypto = require('crypto');function verifyWebhookSignature(req, signingSecret) { const timestamp = req.headers['x-webhook-timestamp']; const signature = req.headers['x-webhook-signature']; const rawBody = req.rawBody; // Must be raw string, not parsed JSON // 1. Check timestamp freshness (5-minute tolerance) const now = Math.floor(Date.now() / 1000); if (Math.abs(now - parseInt(timestamp, 10)) > 300) { throw new Error('Timestamp too old — possible replay attack'); } // 2. Compute expected signature const signatureInput = `${timestamp}.${rawBody}`; const expected = 'v1=' + crypto .createHmac('sha256', signingSecret) .update(signatureInput) .digest('hex'); // 3. Constant-time comparison if (!crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))) { throw new Error('Invalid signature'); } return JSON.parse(rawBody);}
Always verify signatures against the raw request body (the exact bytes received), not a re-serialized JSON object. JSON serialization can alter key ordering, whitespace, or Unicode escaping, which will cause signature mismatches.
Mnemom attempts inline delivery immediately when an event is emitted. Most webhooks arrive within seconds of the triggering event. If inline delivery fails, the event enters the retry queue.
If an endpoint accumulates 100 consecutive failures, it is automatically disabled. The account owner receives an email notification. To resume deliveries:
Fix the underlying issue with your endpoint
Re-enable the endpoint in organization settings (or via PATCH with is_active: true)
Use the id field in the payload envelope as an idempotency key. The same event may be delivered more than once (e.g., after a redeliver request). Your handler should deduplicate using the event ID.
Webhook deliveries are best-effort ordered by creation time. Due to retries and network variance, events may arrive out of order. Use the created_at timestamp for ordering if your use case requires it.
Every endpoint has a “Test” action that sends a synthetic webhook.test event with a test payload. Use this to verify connectivity and signature verification without triggering a real integrity event.
Copy
Ask AI
curl -X POST https://api.mnemom.ai/v1/orgs/{org_id}/webhooks/{endpoint_id}/test \ -H "Authorization: Bearer $TOKEN"
Ensure you’re verifying against the raw request body, not re-serialized JSON
Check that your signing secret is correct — it was only shown once at creation time. If lost, rotate the secret.
Verify the timestamp header is being read correctly (it’s in Unix seconds, not milliseconds)
HTTPS required
Webhook endpoints must use HTTPS. HTTP URLs are rejected at creation time. For local development, use ngrok or a similar tunneling tool.
Timeouts (>10 seconds)
Your endpoint must respond within 10 seconds. If processing takes longer, return 200 immediately and process the event asynchronously (e.g., via a background job queue).
4xx permanent failure
HTTP 4xx responses (except 429) are treated as permanent failures and are not retried. Common causes:
401/403 — Your auth middleware is blocking the request. Mnemom webhooks don’t include bearer tokens.
404 — The endpoint URL path is incorrect.
400 — Your request validation is rejecting the payload format.
Endpoint auto-disabled
After 100 consecutive delivery failures, the endpoint is automatically disabled. Fix the underlying issue, then re-enable the endpoint. The failure counter resets on re-enable.
Events not firing
Verify the endpoint is active (is_active: true)
Check that the event type is included in the endpoint’s event_types (or that event_types is empty for all events)
Confirm the triggering action occurred on an agent linked to an Enterprise billing account
Mnemom does not impose explicit rate limits on outbound deliveries. However, if your endpoint returns 429 (Too Many Requests), we respect that signal and back off for at least 60 seconds before retrying.
Are events delivered in order?
Events are delivered in best-effort order. Due to retries and network conditions, events may arrive out of order. Use the created_at field for sequencing.
What is the maximum payload size?
Webhook payloads are typically under 4 KB. The maximum payload size is 64 KB.
How do I rotate my signing secret?
Use the rotate secret endpoint: POST /v1/orgs/{org_id}/webhooks/{endpoint_id}/rotate-secret. The new secret is returned once. Update your verification code before new deliveries arrive.
Can I have multiple endpoints?
Yes, up to 5 endpoints per organization. Each endpoint can subscribe to different event types.
How long are delivery logs retained?
Delivery records are retained for 30 days. Older records are automatically purged.
What happens to events during endpoint downtime?
Events are queued and retried according to the backoff schedule. If your endpoint recovers within the retry window (~1 hour), all events will be delivered. Beyond that, they are marked as failed but remain in the delivery log for redelivery.