Skip to content

This document was written by AI and has been manually reviewed.

Webhooks

Prism can send an HTTP POST request to a URL of your choice whenever a significant event occurs. Webhooks come in two scopes:

  • User webhooks — configured by any user; fire when that user triggers events (app created/updated/deleted, domain added/verified/deleted, profile updated).
  • Admin webhooks — configured by admins only; fire on audit log events such as user deletions, configuration changes, and so on.

Both share the same payload format, signing mechanism, and delivery behaviour.

How it works

  1. A webhook is created with an endpoint URL, a secret, and a list of subscribed events.
  2. When a matching event is triggered, Prism sends a signed JSON payload to the URL.
  3. Prism records the HTTP response and stores it in the delivery history for that webhook.

Deliveries are best-effort and non-blocking — the originating request is not delayed. If your endpoint is unreachable, the failure is logged in the delivery history but not retried automatically.

User webhooks

Any authenticated user can manage personal webhooks from Settings → Webhooks in the dashboard.

FieldDescription
NameA human-readable label for this webhook
EndpointThe HTTPS URL that will receive the POST requests
SecretUsed to sign the payload. Leave blank to have Prism auto-generate a 32-byte random secret.
EventsOne or more event types to subscribe to, or * to receive every event

The secret is shown only once at creation time — store it somewhere safe.

User events

EventTriggered when
*Wildcard — matches every user event below
app.createdYou created an OAuth application
app.updatedYou updated an OAuth application
app.deletedYou deleted an OAuth application
domain.addedYou added a domain for verification
domain.verifiedA domain you own was successfully verified
domain.deletedYou deleted a domain
profile.updatedYou updated your profile (name, avatar, etc.)

User webhook API

User webhooks can also be managed programmatically using OAuth Bearer tokens or Personal Access Tokens with the appropriate scopes:

ScopeGrants
webhooks:readList webhooks and view delivery history
webhooks:writeCreate, update, delete, and send test pings to your webhooks

Endpoints

GET    /api/oauth/me/webhooks
POST   /api/oauth/me/webhooks
PATCH  /api/oauth/me/webhooks/:id
DELETE /api/oauth/me/webhooks/:id
POST   /api/oauth/me/webhooks/:id/test
GET    /api/oauth/me/webhooks/:id/deliveries

Example: Create a user webhook

bash
curl -X POST https://your-prism.example/api/oauth/me/webhooks \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My App Monitor",
    "url": "https://example.com/hooks/prism",
    "events": ["app.created", "app.deleted"]
  }'

Response:

json
{
  "webhook": {
    "id": "abc123",
    "name": "My App Monitor",
    "url": "https://example.com/hooks/prism",
    "secret": "prism-generated-secret",
    "events": ["app.created", "app.deleted"],
    "is_active": 1,
    "created_at": 1741564800
  }
}

The secret is returned only on creation. Store it securely.

Admin webhooks

Admins can manage site-wide webhooks from Admin → Webhooks in the admin panel. These fire on audit log events and are not visible to regular users.

Admin events

EventTriggered when
*Wildcard — matches every admin event below
admin.config.updateSite configuration was changed
admin.user.updateAn admin updated a user account
admin.user.deleteAn admin deleted a user account
admin.app.updateAn admin updated an OAuth app (verify/deactivate)
admin.team.deleteAn admin deleted a team
invite.createA site invite was created
invite.revokeA site invite was revoked
oauth_source.createAn OAuth provider source was added
oauth_source.updateAn OAuth provider source was updated
oauth_source.deleteAn OAuth provider source was deleted
webhook.createA webhook was created
webhook.updateA webhook was updated
webhook.deleteA webhook was deleted

Admin webhook API

ScopeGrants
admin:webhooks:readList webhooks and view delivery history
admin:webhooks:writeCreate, update, and send test pings to webhooks
admin:webhooks:deletePermanently delete webhooks

Endpoints

GET    /api/oauth/me/admin/webhooks
POST   /api/oauth/me/admin/webhooks
GET    /api/oauth/me/admin/webhooks/:id
PATCH  /api/oauth/me/admin/webhooks/:id
DELETE /api/oauth/me/admin/webhooks/:id
POST   /api/oauth/me/admin/webhooks/:id/test
GET    /api/oauth/me/admin/webhooks/:id/deliveries

All endpoints require a Bearer token whose owner has role = admin.

Example: Create an admin webhook

bash
curl -X POST https://your-prism.example/api/oauth/me/admin/webhooks \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Webhook",
    "url": "https://example.com/hooks/prism",
    "events": ["admin.user.delete", "admin.user.update"]
  }'

Payload format

Both user and admin webhooks send the same JSON structure:

json
{
  "event": "app.created",
  "timestamp": 1741564800,
  "data": {
    "app_id": "xyz789"
  }
}
FieldTypeDescription
eventstringThe event type that triggered this delivery
timestampnumberUnix timestamp (seconds) of when the event occurred
dataobjectEvent context — IDs, names, and other metadata

Verifying the signature

Every request includes an X-Prism-Signature header containing an HMAC-SHA256 hex digest of the raw request body, signed with your webhook's secret.

X-Prism-Signature: sha256=<hex-digest>
X-Prism-Event: app.created
X-Prism-Delivery: <uuid>

To verify in Node.js:

js
import { createHmac, timingSafeEqual } from "node:crypto";

function verifySignature(secret, rawBody, signatureHeader) {
  const expected = "sha256=" + createHmac("sha256", secret)
    .update(rawBody)
    .digest("hex");
  return timingSafeEqual(Buffer.from(expected), Buffer.from(signatureHeader));
}

Always use a timing-safe comparison (timingSafeEqual) to prevent timing attacks. Your endpoint should return a 2xx status to acknowledge receipt; any other status is recorded as a failure.

Sending a test ping

From the webhooks list, click the refresh icon on any webhook row to send a webhook.test event immediately. The result (HTTP status and response body) is shown inline and recorded in the delivery history.

Delivery history

Expand any webhook row to see its last 50 deliveries. Each entry shows:

  • Whether the delivery succeeded (green) or failed (red)
  • The HTTP response status code
  • The event type
  • The time of delivery

Security recommendations

  • Always verify the signature before processing a delivery.
  • Use HTTPS endpoints only — plain HTTP is accepted by Prism but your payload will be visible in transit.
  • Respond quickly (within 10 seconds). Prism times out the delivery after 10 s and records a failure.
  • Rotate the secret periodically via PATCH with a new secret value.
  • Treat the secret like a password — do not log it or commit it to source control.

Released under the GPL-3.0 License.