n8n Integration
Integrate OpenRegister with n8n to create powerful automation workflows. This guide provides step-by-step instructions and ready-to-use workflow templates.
Overview
n8n is a fair-code workflow automation platform that allows you to connect various services and automate tasks. OpenRegister provides two integration approaches:
- Schema Hooks (recommended) — Configure hooks directly on schemas that call n8n workflows synchronously (blocking) or asynchronously on object lifecycle events. Supports advanced validation, data enrichment, and rejection of invalid objects before save.
- Webhook Listeners (legacy) — Use Nextcloud's
webhook_listenersapp for simple event notifications to n8n.
With the n8n integration you can:
- Block saves with sync hooks — n8n validates objects before they are persisted
- Enrich data — n8n adds computed fields before save (e.g., geocoding, KvK lookup)
- Reject invalid objects — return HTTP 422 with validation errors from n8n
- Automatically sync objects to external systems (async)
- Deploy workflows as part of app configuration via import
- Build custom automation workflows
Prerequisites
- Nextcloud 28+ with OpenRegister installed
- n8n instance (self-hosted, cloud, or as Nextcloud ExApp)
- A registered workflow engine in OpenRegister (see Workflow Engine Setup)
- Admin access to both Nextcloud and n8n
Workflow Engine Setup
Before using schema hooks, register your n8n instance as a workflow engine in OpenRegister:
curl -X POST http://localhost:8080/index.php/apps/openregister/api/engines \
-u 'admin:admin' \
-H 'Content-Type: application/json' \
-H 'OCS-APIREQUEST: true' \
-d '{
"name": "n8n Production",
"engineType": "n8n",
"baseUrl": "http://your-n8n-host:5678",
"authType": "bearer",
"authConfig": {
"token": "your-n8n-api-key"
},
"enabled": true
}'
Verify the connection:
curl -X POST http://localhost:8080/index.php/apps/openregister/api/engines/{id}/health \
-u 'admin:admin' \
-H 'OCS-APIREQUEST: true'
Schema Hooks (Recommended)
Schema hooks are configured directly on a schema's hooks JSON property. They fire on object lifecycle events and call n8n workflows via the workflow engine adapter.
How It Works
Sync vs Async Events
| Event | Type | When | Can Block? |
|---|---|---|---|
creating | Sync | Before INSERT | Yes |
updating | Sync | Before UPDATE | Yes |
deleting | Sync | Before DELETE | Yes |
created | Async | After INSERT | No |
updated | Async | After UPDATE | No |
deleted | Async | After DELETE | No |
Configuring a Schema Hook
Add a hook to a schema via the API:
# First, get the current schema
SCHEMA=$(curl -s -u admin:admin -H 'OCS-APIREQUEST: true' \
http://localhost:8080/index.php/apps/openregister/api/schemas/{id})
# Update hooks array (add to existing hooks)
curl -X PUT http://localhost:8080/index.php/apps/openregister/api/schemas/{id} \
-u 'admin:admin' \
-H 'Content-Type: application/json' \
-H 'OCS-APIREQUEST: true' \
-d '{
"hooks": [
{
"event": "creating",
"engine": "n8n",
"workflowId": "your-n8n-workflow-id",
"mode": "sync",
"order": 1,
"timeout": 30,
"enabled": true,
"onFailure": "reject",
"onTimeout": "allow",
"onEngineDown": "allow"
}
]
}'
Hook Configuration Fields
| Field | Type | Default | Description |
|---|---|---|---|
event | string | required | creating, updating, deleting, created, updated, deleted |
engine | string | required | Engine type: n8n or windmill |
workflowId | string | required | The workflow ID in the engine (used for webhook URL) |
mode | string | sync | sync (blocking, waits for response) or async (fire-and-forget) |
order | int | 0 | Execution order when multiple hooks exist for the same event |
timeout | int | 30 | Timeout in seconds for sync hooks |
enabled | bool | true | Toggle hook on/off |
onFailure | string | reject | reject (abort save), allow (proceed), flag (proceed + set metadata), queue (proceed + retry later) |
onTimeout | string | reject | Same options as onFailure |
onEngineDown | string | allow | Same options as onFailure |
n8n Workflow Response Format
Your n8n workflow must return one of these JSON responses:
Approve (allow save):
{"status": "approved"}
Reject (block save, return HTTP 422):
{
"status": "rejected",
"errors": [
{"field": "kvkNumber", "message": "Invalid KvK number", "code": "INVALID_KVK"},
{"field": "email", "message": "Email domain not allowed", "code": "BLOCKED_DOMAIN"}
]
}
Modify (enrich data before save):
{
"status": "modified",
"data": {
"normalizedAddress": "Keizersgracht 1, 1015 AA Amsterdam",
"geocode": {"lat": 52.3676, "lng": 4.8837},
"validatedAt": "2026-03-08T12:00:00Z"
}
}
CloudEvents Payload
Hooks deliver a CloudEvents 1.0 payload to the n8n webhook URL:
{
"specversion": "1.0",
"type": "nl.openregister.object.creating",
"source": "/apps/openregister/registers/1/schemas/5",
"id": "unique-event-uuid",
"time": "2026-03-08T12:00:00Z",
"datacontenttype": "application/json",
"subject": "object:abc-123",
"data": {
"object": {
"id": "abc-123",
"name": "Acme Corp",
"kvkNumber": "12345678"
},
"schema": "organisation",
"register": "1",
"action": "creating",
"hookMode": "sync"
}
}
Deploying Workflows via Import
Instead of manually configuring hooks, you can include workflow definitions in your JSON import file. This enables packaging n8n workflows as part of your app configuration.
{
"info": {
"title": "My App Config",
"version": "1.0.0"
},
"components": {
"schemas": {
"organisation": {
"title": "Organisation",
"slug": "organisation",
"properties": {
"name": {"type": "string"},
"kvkNumber": {"type": "string"}
}
}
},
"workflows": [
{
"name": "kvk-validator",
"engine": "n8n",
"workflow": { "...n8n workflow JSON..." },
"attachTo": {
"schema": "organisation",
"event": "creating",
"mode": "sync",
"onFailure": "reject"
}
}
]
}
}
The import pipeline:
- Creates schemas
- Deploys workflows to n8n via
WorkflowEngineInterface::deployWorkflow() - Wires hooks to schemas using the engine-returned workflow ID
- Creates objects (with hooks now active)
Reimports are idempotent — unchanged workflows (same SHA-256 hash) are skipped. See Import/Export documentation for the full format reference.
Webhook Listeners (Legacy Approach)
Note: The webhook listeners approach requires the
webhook_listenersNextcloud app and uses Nextcloud's event system directly. For most use cases, Schema Hooks are simpler and more powerful — they support sync blocking, data enrichment, and can be deployed via import.
Quick Start (Legacy)
Step 1: Enable webhook_listeners in Nextcloud
docker exec -u 33 <nextcloud-container> php occ app:enable webhook_listeners
Step 2: Import n8n Workflow Template
- Download a template from
openregister/n8n-templates/directory - Open n8n web interface
- Click '+' to add a new workflow
- Click the menu (⋮) in the top right
- Select 'Import from File'
- Choose the downloaded JSON template
- Click 'Import'
Step 3: Configure Webhook in n8n
- Open the imported workflow
- Click on the 'Webhook' node (usually the first node)
- Copy the 'Webhook URL' (e.g.,
https://your-n8n.com/webhook/openregister-object-sync) - Save this URL for the next step
Step 4: Register Webhook in Nextcloud
Register the webhook to trigger on OpenRegister events:
curl -X POST http://<nextcloud-host>/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks \
-H "OCS-APIRequest: true" \
-u "admin:admin" \
-H "Content-Type: application/json" \
-d '{
"httpMethod": "POST",
"uri": "https://your-n8n.com/webhook/openregister-object-sync",
"event": "OCA\\OpenRegister\\Event\\ObjectCreatedEvent",
"eventFilter": []
}'
Step 5: Configure OpenRegister API Credentials
- In n8n, find nodes that call the OpenRegister API (usually 'HTTP Request' nodes)
- Click on 'Credentials'
- Select 'HTTP Basic Auth' or create a new credential
- Enter:
- Username: Your Nextcloud admin username
- Password: Your Nextcloud admin password
- Save the credential
Step 6: Activate the Workflow
- Toggle the workflow to 'Active' in the top right
- Save the workflow
- Test by creating an object in OpenRegister
Available Workflow Templates
OpenRegister provides four ready-to-use n8n workflow templates in the n8n-templates/ directory:
1. Object Sync (openregister-object-sync.json)
Description: Automatically sync OpenRegister objects to an external system when they are created or updated.
Use Cases:
- Keep external databases synchronized
- Archive data to external storage
- Trigger processes in other systems
Events: ObjectCreatedEvent, ObjectUpdatedEvent
Configuration Required:
- OpenRegister API credentials
- External system endpoint and credentials
2. Database Sync (openregister-to-database.json)
Description: Write OpenRegister objects directly to an external MySQL/PostgreSQL database with data transformation.
Use Cases:
- Data warehousing
- Analytics and reporting
- External system integration
Events: ObjectCreatedEvent, ObjectUpdatedEvent
Configuration Required:
- OpenRegister API credentials
- Database credentials (MySQL/PostgreSQL)
Database Schema Example:
CREATE TABLE openregister_objects (
uuid VARCHAR(36) PRIMARY KEY,
register_name VARCHAR(255),
schema_name VARCHAR(255),
title VARCHAR(255),
description TEXT,
data_json JSON,
organisation VARCHAR(36),
created_at TIMESTAMP,
updated_at TIMESTAMP,
synced_at TIMESTAMP
);
3. Bidirectional Sync (openregister-bidirectional-sync.json)
Description: Two-way synchronization between OpenRegister and an external system.
Use Cases:
- CRM integration
- ERP system sync
- Multi-system data consistency
Events: ObjectCreatedEvent, ObjectUpdatedEvent, ObjectDeletedEvent
Configuration Required:
- OpenRegister API credentials
- External system API credentials
- Polling interval (default: 5 minutes)
How It Works:
- From OpenRegister: Webhook triggers on object changes → Syncs to external system
- To OpenRegister: Scheduled trigger polls external system → Updates OpenRegister
4. Schema Notifications (openregister-schema-notifications.json)
Description: Send notifications to Slack, Email, and Microsoft Teams when schemas are created, updated, or deleted.
Use Cases:
- Team collaboration
- Change management
- Schema documentation
Events: SchemaCreatedEvent, SchemaUpdatedEvent, SchemaDeletedEvent
Configuration Required:
- Slack webhook URL or OAuth credentials
- SMTP credentials for email
- Microsoft Teams webhook URL
Customizing Workflows
Modifying Event Types
To listen to different events, update the webhook registration:
# Listen to schema updates instead of object creation
curl -X POST http://<nextcloud-host>/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks \
-H "OCS-APIRequest: true" \
-u "admin:admin" \
-H "Content-Type: application/json" \
-d '{
"httpMethod": "POST",
"uri": "https://your-n8n.com/webhook/my-workflow",
"event": "OCA\\OpenRegister\\Event\\SchemaUpdatedEvent",
"eventFilter": []
}'
Adding Data Transformations
Use the 'Code' node in n8n to transform data:
// Example: Transform OpenRegister object to external format.
const object = $input.item.json;
return {
external_id: object.uuid,
name: object.data.title || 'Untitled',
description: object.data.description || '',
custom_fields: {
register: object.register,
schema: object.schema,
created: object.created
},
metadata: object.data
};
Error Handling
Add error handling to your workflows:
- Add an 'Error Trigger' node
- Connect it to error handling logic (e.g., send error notification)
- Configure retry logic in HTTP Request nodes
Example Error Handler:
// Log error and send notification.
const error = $input.item.json;
return {
error_type: error.name,
error_message: error.message,
timestamp: new Date().toISOString(),
workflow: $workflow.name
};
Advanced Configuration
Filtering Events
Filter events in Nextcloud webhook registration:
{
"httpMethod": "POST",
"uri": "https://your-n8n.com/webhook/my-workflow",
"event": "OCA\\OpenRegister\\Event\\ObjectCreatedEvent",
"eventFilter": {
"user.uid": "specific_user"
}
}
Multiple Webhooks
Register multiple webhooks for different event types:
# Webhook for object creation.
curl -X POST http://<nextcloud-host>/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks \
-H "OCS-APIRequest: true" \
-u "admin:admin" \
-d '{"httpMethod":"POST","uri":"https://n8n.com/webhook/object-created","event":"OCA\\OpenRegister\\Event\\ObjectCreatedEvent"}'
# Webhook for schema updates.
curl -X POST http://<nextcloud-host>/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks \
-H "OCS-APIRequest: true" \
-u "admin:admin" \
-d '{"httpMethod":"POST","uri":"https://n8n.com/webhook/schema-updated","event":"OCA\\OpenRegister\\Event\\SchemaUpdatedEvent"}'
Using OpenRegister API in n8n
Access the full OpenRegister API from n8n workflows:
Get Object by UUID:
GET http://master-nextcloud-1/apps/openregister/api/objects/{uuid}
List Objects:
GET http://master-nextcloud-1/apps/openregister/api/objects?register=my-register&_limit=50
Create Object:
POST http://master-nextcloud-1/apps/openregister/api/objects
Body: {
"register": "my-register",
"schema": "my-schema",
"data": {
"title": "New Object",
"description": "Created from n8n"
}
}
Update Object:
PUT http://master-nextcloud-1/apps/openregister/api/objects/{uuid}
Body: {
"data": {
"title": "Updated Title"
}
}
Delete Object:
DELETE http://master-nextcloud-1/apps/openregister/api/objects/{uuid}
Troubleshooting
Webhook Not Triggering
Problem: n8n workflow not receiving webhook requests.
Solutions:
- Verify webhook is registered:
curl -X GET http://<nextcloud-host>/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks \
-H "OCS-APIRequest: true" \
-u "admin:admin" - Check n8n webhook URL is correct and accessible
- Ensure workflow is 'Active' in n8n
- Test webhook manually with curl:
curl -X POST https://your-n8n.com/webhook/test \
-H "Content-Type: application/json" \
-d '{"test": "data"}'
API Authentication Errors
Problem: HTTP 401 Unauthorized when calling OpenRegister API.
Solutions:
- Verify credentials are correct
- Check user has appropriate permissions
- Use admin user for testing
- Ensure credentials are saved in n8n
Data Not Transforming Correctly
Problem: Data transformation in Code nodes not working as expected.
Solutions:
- Use 'Execute workflow' in n8n to test transformations
- Add console.log() statements (visible in execution logs)
- Check input data structure using 'Edit Fields' node
- Review JavaScript syntax and n8n-specific functions
Workflow Executions Failing
Problem: Workflow shows errors in execution history.
Solutions:
- Check execution logs in n8n
- Verify all credentials are configured
- Test individual nodes using 'Execute Node'
- Add error handling nodes
- Check external system availability
Best Practices
- Use Specific Event Types: Don't subscribe to all events; only listen to what you need
- Implement Error Handling: Add Error Trigger nodes to handle failures gracefully
- Add Logging: Use Code nodes to log important information
- Test Incrementally: Test each node individually before activating the workflow
- Monitor Executions: Regularly review workflow execution history
- Version Control: Export workflows regularly as backup
- Document Customizations: Add notes to nodes explaining custom logic
Performance Considerations
- Batch Processing: For high-volume scenarios, batch multiple operations together
- Async Processing: Use n8n's queue mode for long-running operations
- Rate Limiting: Implement rate limiting when calling external APIs
- Caching: Cache frequently accessed data to reduce API calls
Examples
Example 1: Send Slack Notification on Object Creation
- Import
openregister-object-sync.jsontemplate - Replace 'Send to External System' node with 'Slack' node
- Configure Slack credentials
- Set channel and message format
- Activate workflow
Example 2: Create Airtable Records from OpenRegister
- Import
openregister-object-sync.jsontemplate - Replace external system node with 'Airtable' node
- Configure Airtable credentials and base
- Map OpenRegister fields to Airtable columns
- Activate workflow
Example 3: Sync to Google Sheets
- Import
openregister-to-database.jsontemplate - Replace database node with 'Google Sheets' node
- Configure Google Sheets credentials
- Map fields to sheet columns
- Activate workflow
Further Reading
- Webhooks Feature Documentation
- Events API Reference
- n8n Official Documentation
- OpenRegister API Documentation
Support
For issues specific to:
- n8n workflows: n8n community forum or GitHub
- OpenRegister integration: OpenRegister GitHub issues
- Nextcloud webhooks: Nextcloud documentation