Webhooks and Schema Hooks
OpenRegister provides two systems for integrating with external workflows:
- Schema Hooks (recommended for business logic) — Hooks configured directly on schemas that call workflow engines (n8n, Windmill) on object lifecycle events. Support synchronous blocking (approve/reject/modify before save) and async notifications.
- Webhook Entities (for general event notifications) — Standalone webhook subscriptions with retries, HMAC signing, event filtering, and delivery tracking.

Choosing the Right Approach
| Feature | Schema Hooks | Webhook Entities |
|---|---|---|
| Block saves (sync) | Yes | Limited |
| Reject with errors (HTTP 422) | Yes | No |
| Enrich/modify data before save | Yes | No |
| CloudEvents 1.0 format | Yes | Optional |
| Automatic retries | Via failure modes | Yes (exponential/linear/fixed) |
| HMAC signature verification | No (engine auth) | Yes |
| Delivery statistics | Via logs | Yes |
| Deploy via import | Yes | No |
| Multiple engines | Yes (n8n, Windmill) | Any HTTP endpoint |
Use Schema Hooks when: you need business logic validation, data enrichment, or blocking saves based on external rules.
Use Webhook Entities when: you need simple event notifications to arbitrary HTTP endpoints with retries and delivery tracking.
Schema Hooks
Schema hooks are the recommended way to add business logic to object lifecycle events. They are configured on the schema's hooks JSON property and execute via workflow engines.
See the n8n Integration guide for complete setup instructions, or the Schema Hooks specification for the full technical spec.
Key Capabilities
- Sync hooks (
creating,updating,deleting) fire BEFORE the database write and can block it - Async hooks (
created,updated,deleted) fire AFTER the write as fire-and-forget notifications - Failure modes:
reject(abort save),allow(proceed anyway),flag(proceed + set validation metadata),queue(proceed + retry later) - Chained hooks: Multiple hooks on the same event execute in order; each receives data modified by the previous hook
- Deploy via import: Include workflow definitions in your JSON import file — they are automatically deployed and wired to schemas
Example: Sync Validation Hook
{
"hooks": [
{
"event": "creating",
"engine": "n8n",
"workflowId": "wf-abc123",
"mode": "sync",
"order": 1,
"timeout": 30,
"enabled": true,
"onFailure": "reject",
"onTimeout": "allow",
"onEngineDown": "allow"
}
]
}
The n8n workflow receives a CloudEvents 1.0 payload and returns:
{"status": "approved"}— save proceeds{"status": "rejected", "errors": [...]}— save blocked, HTTP 422 returned to client{"status": "modified", "data": {...}}— data merged into object before save
Webhook Entities
OpenRegister also includes a standalone webhook entity system for general-purpose event notifications. This provides a robust, production-ready solution with automatic retries, event filtering, and comprehensive monitoring.
Use Case 1: Event Notifications
The simplest use case for webhooks is notifying external systems when objects are created, updated, or deleted. This enables real-time synchronization between OpenRegister and other applications.
Example: Pet Store Inventory Sync
Imagine a pet store using OpenRegister to manage its inventory. When a new cat is added to the store, the point-of-sale (POS) system needs to be notified so it can include the new product in its product list.
Configuration:
{
"name": "POS Inventory Sync",
"url": "https://pos-system.example.com/api/products",
"method": "POST",
"events": ["OCA\\OpenRegister\\Event\\ObjectCreatedEvent"],
"filters": {
"objectType": "object",
"schema": "pet-store-cat-schema"
},
"enabled": true
}
When a cat object is created, OpenRegister automatically sends a CloudEvent to the POS system, which then updates its product catalog in real-time.
Use Case 2: Business Logic and Decision Making
Note: For business logic integration, Schema Hooks are now the recommended approach. They provide a cleaner configuration model, proper sync blocking with HTTP 422 responses, and can be deployed via import. The webhook entity approach below still works but is more complex to set up.
Webhooks can also be used to add complex business logic and decision-making to the internal flow of registers. This is particularly useful when validation rules are too complex for JSON schema validation.
Example: Complex Pet Store Rules
Consider a pet store with complex business rules:
- Rule 1: Cannot create cats named "Felix" in the month of December
- Rule 2: Cannot create cats named "Felix" when there are already 5 or more cats with that name in the store
These rules involve:
- Date-based validation (checking if current month is December)
- Aggregation logic (counting existing cats with the same name)
- External data validation (potentially checking against external APIs)
JSON schema validation cannot handle this complexity. Instead, we can use webhooks to register to the object pre-create event and fire a synchronous webhook to an external tool like n8n that allows us to graphically build business logic flows.
Configuration:
{
"name": "Felix Cat Validation",
"url": "http://n8n:5678/webhook/felix-validation",
"method": "POST",
"events": ["OCA\\OpenRegister\\Event\\ObjectCreatingEvent"],
"filters": {
"objectType": "object",
"schema": "pet-store-cat-schema",
"data.@self.name": "Felix"
},
"enabled": true,
"configuration": {
"interceptRequests": true,
"async": false,
"processResponse": true,
"responseProcessing": {
"mergeStrategy": "merge"
}
}
}
n8n Workflow Capabilities:
The n8n workflow can perform complex operations that JSON schema cannot:
- Date/Time Logic: Check if current date is in December
- API Queries: Query OpenRegister API to count existing cats with name "Felix"
- External API Calls: Validate against external services (e.g., check if Felix is a registered trademark, verify against pet registry databases)
- Data Transformation: Transform or enrich the request data before validation
- Conditional Logic: Implement complex if/then/else rules
- Aggregations: Count, sum, or perform other aggregations on existing data
Response Handling:
The n8n workflow returns a response that OpenRegister uses to determine whether to continue:
- Success Response: Object creation proceeds
- Error Response: Object creation is blocked, error message shown to user
This enables powerful business logic that would be impossible to implement with JSON schema alone.
Key Features
- Event-Driven Architecture: Subscribe to specific OpenRegister events
- Automatic Retries: Configurable retry policies (exponential, linear, fixed)
- Event Filtering: Filter events based on payload data
- Secure: HMAC-SHA256 signature verification
- Statistics: Track delivery success rates and last execution times
- Custom Headers: Add authentication headers or custom metadata
- Wildcard Support: Use wildcards to match multiple events
Requirements
- Nextcloud 28 or higher
- OpenRegister app installed and enabled
- External system to receive webhooks (n8n, Windmill, custom endpoint)
Managing Webhooks
OpenRegister provides a RESTful API for managing webhooks.

Creating a Webhook
curl -H 'OCS-APIRequest: true' -X POST http://localhost:8080/index.php/apps/openregister/api/webhooks \
-u 'admin:admin' \
-H 'Content-Type: application/json' \
-d '{
"name": "My Webhook",
"url": "https://my-server.com/webhook",
"method": "POST",
"events": [
"OCA\\OpenRegister\\Event\\ObjectCreatedEvent",
"OCA\\OpenRegister\\Event\\ObjectUpdatedEvent"
],
"enabled": true,
"timeout": 30,
"maxRetries": 3,
"retryPolicy": "exponential"
}'
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Webhook display name |
url | string | Yes | Target URL to call |
method | string | No | HTTP method: GET, POST, PUT, PATCH, DELETE (default: POST) |
events | array | No | Event class names (empty = all events) |
enabled | boolean | No | Enable/disable webhook (default: true) |
headers | object | No | Custom HTTP headers |
secret | string | No | Secret for HMAC signature |
filters | object | No | Event payload filters |
timeout | integer | No | Request timeout in seconds (default: 30) |
maxRetries | integer | No | Maximum retry attempts (default: 3) |
retryPolicy | string | No | Retry policy: exponential, linear, fixed (default: exponential) |
Listing Webhooks
curl -H 'OCS-APIRequest: true' -X GET http://localhost:8080/index.php/apps/openregister/api/webhooks \
-u 'admin:admin'
Getting a Webhook
curl -H 'OCS-APIRequest: true' -X GET http://localhost:8080/index.php/apps/openregister/api/webhooks/{id} \
-u 'admin:admin'
Updating a Webhook
curl -H 'OCS-APIRequest: true' -X PUT http://localhost:8080/index.php/apps/openregister/api/webhooks/{id} \
-u 'admin:admin' \
-H 'Content-Type: application/json' \
-d '{
"enabled": false
}'
Deleting a Webhook
curl -H 'OCS-APIRequest: true' -X DELETE http://localhost:8080/index.php/apps/openregister/api/webhooks/{id} \
-u 'admin:admin'
Testing a Webhook
curl -H 'OCS-APIRequest: true' -X POST http://localhost:8080/index.php/apps/openregister/api/webhooks/{id}/test \
-u 'admin:admin'

The test endpoint sends a test payload to verify webhook configuration. After testing, the webhook list automatically refreshes to show updated statistics (Last Triggered, Success Rate).
Listing Available Events
curl -H 'OCS-APIRequest: true' -X GET http://localhost:8080/index.php/apps/openregister/api/webhooks/events \
-u 'admin:admin'
Available Events
OpenRegister dispatches events for all entity lifecycle operations. Below is a complete list of available events.
Object Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\ObjectCreatedEvent | Object created | After new object is saved |
OCA\OpenRegister\Event\ObjectUpdatedEvent | Object updated | After object is modified |
OCA\OpenRegister\Event\ObjectDeletedEvent | Object deleted | After object is removed |
OCA\OpenRegister\Event\ObjectLockedEvent | Object locked | After object is locked |
OCA\OpenRegister\Event\ObjectUnlockedEvent | Object unlocked | After object is unlocked |
OCA\OpenRegister\Event\ObjectRevertedEvent | Object reverted | After object is reverted to previous version |
Register Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\RegisterCreatedEvent | Register created | After new register is saved |
OCA\OpenRegister\Event\RegisterUpdatedEvent | Register updated | After register is modified |
OCA\OpenRegister\Event\RegisterDeletedEvent | Register deleted | After register is removed |
Schema Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\SchemaCreatedEvent | Schema created | After new schema is saved |
OCA\OpenRegister\Event\SchemaUpdatedEvent | Schema updated | After schema is modified |
OCA\OpenRegister\Event\SchemaDeletedEvent | Schema deleted | After schema is removed |
Application Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\ApplicationCreatedEvent | Application created | After new application is saved |
OCA\OpenRegister\Event\ApplicationUpdatedEvent | Application updated | After application is modified |
OCA\OpenRegister\Event\ApplicationDeletedEvent | Application deleted | After application is removed |
Agent Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\AgentCreatedEvent | Agent created | After new agent is saved |
OCA\OpenRegister\Event\AgentUpdatedEvent | Agent updated | After agent is modified |
OCA\OpenRegister\Event\AgentDeletedEvent | Agent deleted | After agent is removed |
Source Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\SourceCreatedEvent | Source created | After new source is saved |
OCA\OpenRegister\Event\SourceUpdatedEvent | Source updated | After source is modified |
OCA\OpenRegister\Event\SourceDeletedEvent | Source deleted | After source is removed |
Configuration Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\ConfigurationCreatedEvent | Configuration created | After new configuration is saved |
OCA\OpenRegister\Event\ConfigurationUpdatedEvent | Configuration updated | After configuration is modified |
OCA\OpenRegister\Event\ConfigurationDeletedEvent | Configuration deleted | After configuration is removed |
View Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\ViewCreatedEvent | View created | After new view is saved |
OCA\OpenRegister\Event\ViewUpdatedEvent | View updated | After view is modified |
OCA\OpenRegister\Event\ViewDeletedEvent | View deleted | After view is removed |
Conversation Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\ConversationCreatedEvent | Conversation created | After new conversation is saved |
OCA\OpenRegister\Event\ConversationUpdatedEvent | Conversation updated | After conversation is modified |
OCA\OpenRegister\Event\ConversationDeletedEvent | Conversation deleted | After conversation is removed |
Organisation Events
| Event | Description | When Triggered |
|---|---|---|
OCA\OpenRegister\Event\OrganisationCreatedEvent | Organisation created | After new organisation is saved |
OCA\OpenRegister\Event\OrganisationUpdatedEvent | Organisation updated | After organisation is modified |
OCA\OpenRegister\Event\OrganisationDeletedEvent | Organisation deleted | After organisation is removed |
Webhook Payload
All webhooks receive a standardized payload. The format depends on the HTTP method:
POST, PUT, PATCH, DELETE Methods
For these methods, the payload is sent as JSON in the request body:
{
"event": "OCA\\OpenRegister\\Event\\ObjectCreatedEvent",
"webhook": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My Webhook"
},
"data": {
"objectType": "object",
"action": "created",
"object": {
"id": 123,
"uuid": "abc-123",
"...": "..."
},
"register": "my-register-uuid",
"schema": "my-schema-uuid"
},
"timestamp": "2025-11-20T20:00:00+00:00",
"attempt": 1
}
GET Method
For GET requests, the payload is sent as query parameters instead of a JSON body:
GET /webhook-endpoint?event=OCA%5COpenRegister%5CEvent%5CObjectCreatedEvent&webhook[id]=550e8400-e29b-41d4-a716-446655440000&webhook[name]=My%20Webhook&data[objectType]=object&data[action]=created×tamp=2025-11-20T20:00:00%2B00:00&attempt=1
The query parameters are URL-encoded versions of the same payload structure.
Payload Structure
| Field | Type | Description |
|---|---|---|
event | string | Full event class name |
webhook.id | string | Webhook UUID |
webhook.name | string | Webhook name |
data | object | Event-specific data |
timestamp | string | ISO 8601 timestamp |
attempt | integer | Delivery attempt number (1 for first attempt) |
Event Filtering
You can filter which events trigger webhooks using the filters parameter:
{
"filters": {
"objectType": "object",
"action": "created",
"register": "my-specific-register"
}
}
Filters support:
- Exact matching: Filter value must match payload value exactly
- Array matching: Payload value must be in the filter array
- Dot notation: Access nested payload values (e.g.,
'object.uuid')
Example with array filter:
{
"filters": {
"action": ["created", "updated"]
}
}
Security
HMAC Signature Verification
When you provide a secret during webhook creation, OpenRegister signs each payload with HMAC-SHA256 and includes the signature in the X-Webhook-Signature header.
The secret is stored encrypted with Nextcloud's ICrypto and decrypted only to sign a delivery; the API returns it as ***. A secret the instance can no longer decrypt (for example after the instance secret changed) stops deliveries for that webhook instead of sending them unsigned; set the secret again to resume.
To verify signatures:
import hmac
import hashlib
import json
def verify_webhook(payload_body, signature, secret):
expected = hmac.new(
secret.encode('utf-8'),
payload_body,
hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, signature)
# In your webhook endpoint
signature = request.headers.get('X-Webhook-Signature')
is_valid = verify_webhook(request.body, signature, 'your-secret')
Custom Headers
Add authentication headers or custom metadata:
{
"headers": {
"Authorization": "Bearer your-token",
"X-Custom-Header": "value"
}
}
Retry Policies
OpenRegister supports three retry policies:
Exponential Backoff (default)
Doubles the delay after each failure:
- Attempt 1: Immediate
- Attempt 2: 2 minutes
- Attempt 3: 4 minutes
- Attempt 4: 8 minutes
Linear Backoff
Increases delay linearly:
- Attempt 1: Immediate
- Attempt 2: 5 minutes
- Attempt 3: 10 minutes
- Attempt 4: 15 minutes
Fixed Delay
Constant delay between retries:
- All retries: 5 minutes
Wildcard Events
Subscribe to multiple events using wildcards:
{
"events": [
"OCA\\OpenRegister\\Event\\Object*",
"OCA\\OpenRegister\\Event\\*CreatedEvent"
]
}
Or leave events empty to receive all events:
{
"events": []
}
Monitoring
Each webhook tracks delivery statistics:
| Metric | Description |
|---|---|
totalDeliveries | Total delivery attempts |
successfulDeliveries | Successful deliveries |
failedDeliveries | Failed deliveries |
lastTriggeredAt | Last delivery attempt timestamp |
lastSuccessAt | Last successful delivery timestamp |
lastFailureAt | Last failed delivery timestamp |
Integrations
See platform-specific integration guides:
Examples
Subscribe to All Object Events
{
"name": "Object Monitor",
"url": "https://my-server.com/webhooks/objects",
"events": ["OCA\\OpenRegister\\Event\\Object*"],
"enabled": true
}