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. With OpenRegister's webhook integration, you can:
- Automatically sync objects to external systems
- Trigger notifications on schema changes
- Create bidirectional data synchronization
- Build custom automation workflows
Prerequisites
- Nextcloud 28+ with OpenRegister installed
- n8n instance (self-hosted or cloud)
- Nextcloud
webhook_listenersapp enabled - Admin access to both Nextcloud and n8n
Quick Start
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