Install
openclaw skills install n8n-code-automation-nelmazIntegrate n8n workflow automation into coding tasks. Use when building automated workflows, integrating n8n into development pipelines, executing existing workflows, modifying workflow configurations, or creating new automation solutions. ⚠️ **SECURITY UPDATE v1.1.0** - This version addresses critical security vulnerabilities from v1.0.0. See SECURITY section below.
openclaw skills install n8n-code-automation-nelmazThis version addresses CRITICAL SECURITY VULNERABILITIES present in v1.0.0:
nelflow.cloud domain, now configurable/data/.openclaw/logs/n8n-audit.logIf you were using v1.0.0, please migrate:
Remove credentials from config:
# Edit ~/.openclaw/openclaw.json
# REMOVE any N8N_URL or N8N_API_KEY entries
Set environment variables:
export N8N_URL="https://your-n8n-instance.com"
export N8N_API_KEY="your-api-key"
Set permission mode (optional):
export N8N_PERMISSION_MODE="readonly" # recommended for production
See SECURITY section below for complete migration guide.
Enable n8n workflow automation capabilities for coding tasks. Use n8n to build, manage, and execute automated workflows that integrate with your development processes, CI/CD pipelines, data processing, and API integrations.
X-N8N-API-KEY/api⚠️ IMPORTANT: API keys MUST be stored as environment variables, NEVER in config files.
Do NOT do this:
{
"env": {
"N8N_URL": "https://n8n.example.com", // ❌ INSECURE
"N8N_API_KEY": "your-api-key-here" // ❌ CRITICAL SECURITY ISSUE
}
}
✅ CORRECT approach:
# Set at system level, never in files
export N8N_URL="https://your-n8n.com"
export N8N_API_KEY="your-api-key"
The skill operates in three permission modes:
| Mode | Read | Execute | Create | Update | Delete | Risk Level |
|---|---|---|---|---|---|---|
readonly | ✅ | ✅ | ❌ | ❌ | ❌ | 🟢 LOW |
restricted | ✅ | ✅ | ✅* | ✅* | ❌ | 🟡 MEDIUM |
full | ✅ | ✅ | ✅ | ✅ | ✅* | 🔴 HIGH |
Default mode: readonly
To change mode:
export N8N_PERMISSION_MODE="full" # DANGEROUS - only for trusted environments
curl -X GET "$N8N_URL/api/v1/workflows" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json"
Response:
{
"data": [
{
"id": "abc123",
"name": "Example Workflow",
"nodes": [...],
"connections": {...},
"active": true,
"settings": {}
}
]
}
curl -X GET "$N8N_URL/api/v1/workflows/abc123" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json"
curl -X GET "$N8N_URL/api/v1/workflows/abc123/executions" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
Filter options:
?limit=10 - Limit results?startDate=2024-01-01 - Start date?endDate=2024-01-31 - End date?status=success - Filter by statuscurl -X GET "$N8N_URL/api/v1/executions/xyz789" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
Confirmation required: The skill will ask for approval before execution.
# Step 1: Review workflow
curl -X GET "$N8N_URL/api/v1/workflows/{id}" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
# Step 2: Execute (with confirmation)
curl -X POST "$N8N_URL/api/v1/workflows/{id}/executions" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json" \
-d '{"data": {"contextData": {}, "manualExecution": true}}'
curl -X POST "$N8N_URL/api/v1/workflows/{id}/executions" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": {
"contextData": {
"input": {
"parameter1": "value1",
"parameter2": "value2"
}
}
}
}'
curl -X POST "https://your-n8n.com/webhook/your-webhook-key" \
-H "Content-Type: application/json" \
-d '{
"data": {
"input1": "value1",
"input2": "value2"
}
}'
⚠️ These operations require TWO confirmations:
# Step 1: Show what will be cloned
curl -X GET "$N8N_URL/api/v1/workflows/{source-id}" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
# Step 2: Execute with confirmation
curl -X POST "$N8N_URL/api/v1/workflows/{source-id}/clone" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Cloned Workflow"}'
# Step 1: Show current state
curl -X GET "$N8N_URL/api/v1/workflows/{id}" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
# Step 2: Show diff
# (Display what will change)
# Step 3: Execute with confirmation
curl -X PATCH "$N8N_URL/api/v1/workflows/{id}" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json" \
-d '{"nodes": [{"parameters": {...}}]}'
# Step 1: Show workflow details
curl -X GET "$N8N_URL/api/v1/workflows/{id}" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
# Step 2: Type confirmation
# DELETE: Workflow Name - Type "I confirm deletion" to proceed
# Step 3: Execute
curl -X DELETE "$N8N_URL/api/v1/workflows/{id}" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
Scenario: Trigger build/test workflows from code commits.
# .github/workflows/n8n-trigger.yml
name: Trigger N8N Workflow
on:
push:
branches: [ main ]
jobs:
trigger-n8n:
runs-on: ubuntu-latest
steps:
- name: Trigger N8N workflow
env:
N8N_URL: ${{ secrets.N8N_URL }}
N8N_API_KEY: ${{ secrets.N8N_API_KEY }}
run: |
curl -X POST "$N8N_URL/api/v1/workflows/${{ secrets.N8N_WORKFLOW_ID }}/executions" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json" \
-d '{"data": {"contextData": {"commitSha": "${{ github.sha }}"}}}'
Scenario: Process and transform data automatically.
Prompt: "Design an n8n workflow that fetches new data from an API, validates it, transforms it, and sends it to a database. Use HTTP Request nodes for API calls, Function nodes for validation and transformation, and Database nodes for storage."
Scenario: Run test suites automatically and send results to Slack.
Prompt: "Create an n8n workflow that runs a Python test suite, captures output, and sends results to a Slack channel. Include HTTP Request nodes to trigger tests and a Slack node to send formatted results."
Scenario: Execute periodic maintenance tasks.
Prompt: "Set up an n8n workflow that runs every morning at 6 AM to:
Scenario: Connect multiple services via automated workflows.
Prompt: "Create an n8n workflow that:
function validateN8NUrl(url) {
// Must be HTTPS
if (!url.match(/^https:\/\//i)) {
throw new Error('URL must use HTTPS');
}
// Valid domain format
if (!url.match(/^https:\/\/[a-z0-9.-]+(\.[a-z0-9.-]+)+$/i)) {
throw new Error('Invalid domain format');
}
// No credentials in URL
if (url.includes('@')) {
throw new Error('URL must not contain credentials');
}
// No suspicious parameters
if (url.match(/(\b(key|token|secret|password|auth)\b)/i)) {
throw new Error('URL must not contain secret keywords');
}
return url;
}
function sanitizeData(data) {
const sensitive = ['password', 'apiKey', 'api_key', 'secret', 'token', 'credential'];
const sanitized = JSON.parse(JSON.stringify(data));
function clean(obj) {
for (const key in obj) {
if (sensitive.some(s => key.toLowerCase().includes(s))) {
obj[key] = '***REDACTED***';
} else if (typeof obj[key] === 'object') {
clean(obj[key]);
}
}
}
clean(sanitized);
return sanitized;
}
All actions are logged to:
/data/.openclaw/logs/n8n-audit.log
Log format:
{
"timestamp": "2024-04-04T00:30:45.123Z",
"user": "nelson",
"action": "WORKFLOW_EXECUTE",
"workflowId": "abc123",
"workflowName": "CI Build",
"status": "success",
"durationMs": 234
}
Default limits (configurable):
| Operation | Limit | Window |
|---|---|---|
| API requests | 10 | per minute |
| Workflow executions | 5 | per minute |
| Bulk operations | 1 | per 5 minutes |
{
"name": "Webhook → Database",
"nodes": [
{
"type": "n8n-nodes-base.webhook",
"name": "Webhook",
"parameters": {
"httpMethod": "POST",
"path": "webhook"
}
},
{
"type": "n8n-nodes-base.httpRequest",
"name": "Save to Database",
"parameters": {
"method": "POST",
"url": "https://your-api.com/entries",
"bodyParameters": "={{$json}}"
}
}
],
"connections": {
"Webhook": {
"main": [[{"node": "Save to Database", "type": "main", "index": 0}]]
}
}
}
{
"name": "Scheduled Data Sync",
"nodes": [
{
"type": "n8n-nodes-base.cron",
"name": "Schedule",
"parameters": {
"rule": "every day at 6:00"
}
},
{
"type": "n8n-nodes-base.httpRequest",
"name": "Fetch Data",
"parameters": {
"method": "GET",
"url": "https://api.example.com/data"
}
},
{
"type": "n8n-nodes-base.function",
"name": "Transform",
"parameters": {
"functionCode": "return items.map(item => ({ json: { ...item.json, syncedAt: new Date() } }))"
}
},
{
"type": "n8n-nodes-base.postgres",
"name": "Save",
"parameters": {
"operation": "insert",
"table": "synced_data"
}
}
],
"connections": {
"Schedule": {"main": [[{"node": "Fetch Data", "type": "main", "index": 0}]]},
"Fetch Data": {"main": [[{"node": "Transform", "type": "main", "index": 0}]]},
"Transform": {"main": [[{"node": "Save", "type": "main", "index": 0}]]}
}
}
Error: Unauthorized
Solution: Verify API key is correct and has necessary permissions
Error: Workflow not found
Solution: Check workflow ID and ensure workflow exists
Error: Execution failed
Solution: Check workflow execution logs for node-specific errors
Error: Rate limit exceeded
Solution: Wait and retry, or upgrade your plan
Error: Invalid URL - Must be HTTPS
Solution: Ensure N8N_URL starts with https://
1. Set Environment Variables (REQUIRED):
# NEVER store these in config files
export N8N_URL="https://your-n8n-instance.com"
export N8N_API_KEY="your-api-key"
2. Set Permission Mode (OPTIONAL):
export N8N_PERMISSION_MODE="readonly" # recommended for production
3. List workflows:
curl -X GET "$N8N_URL/api/v1/workflows" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
4. Execute a workflow:
curl -X POST "$N8N_URL/api/v1/workflows/YOUR_WORKFLOW_ID/executions" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
5. Start building:
Need help? Check N8N community forums or documentation at https://community.n8n.io/