Skill: marlowne12/n8n-openclaw-bridge (version 1.0.0)

# n8n OpenClaw Bridge — Automate Everything Connect your OpenClaw agent to n8n for powerful workflow automation. This skill teaches your agent how to create, trigger, manage, and monitor n8n workflows — turning your AI assistant into a full automation operator. ## When to Use Use this skill when: - You want your OpenClaw agent to trigger n8n workflows (send data, kick off automations) - You need to create n8n workflows from natural language descriptions - You want your agent to monitor workflow execution and handle errors - You're building AI-in-the-loop automations (agent decides → n8n executes) - You want to manage your n8n instance without opening the UI **Triggers:** "create a workflow", "trigger automation", "n8n workflow", "automate this process", "set up a webhook", "monitor my workflows", "workflow failed" ## Prerequisites - n8n instance running (local Docker or cloud) - n8n API key (Settings → API → Create API Key) - Agent needs the API URL and key stored in environment or TOOLS.md ### Quick Setup Add to your agent's `TOOLS.md`: ```markdown ## n8n - **URL:** http://localhost:5678 (or your n8n cloud URL) - **API Key:** [your-api-key] - **Version:** 2.x+ ``` Or set environment variables: ```bash export N8N_API_URL="http://localhost:5678" export N8N_API_KEY="your-api-key-here" ``` ## Capabilities ### 1. Workflow Management #### List Workflows ```bash curl -s -H "X-N8N-[REDACTED_SECRET]" "$N8N_API_URL/api/v1/workflows" | jq '.data[] | {id, name, active}' ``` #### Get Workflow Details ```bash curl -s -H "X-N8N-[REDACTED_SECRET]" "$N8N_API_URL/api/v1/workflows/{id}" | jq '.' ``` #### Activate/Deactivate Workflow ```bash # Activate curl -s -X PATCH -H "X-N8N-[REDACTED_SECRET]" -H "Content-Type: application/json" \ -d '{"active": true}' "$N8N_API_URL/api/v1/workflows/{id}" # Deactivate curl -s -X PATCH -H "X-N8N-[REDACTED_SECRET]" -H "Content-Type: application/json" \ -d '{"active": false}' "$N8N_API_URL/api/v1/workflows/{id}" ``` #### Delete Workflow ```bash curl -s -X DELETE -H "X-N8N-[REDACTED_SECRET]" "$N8N_API_URL/api/v1/workflows/{id}" ``` ### 2. Trigger Workflows via Webhook The most common pattern: your agent triggers an n8n workflow by sending data to a webhook. #### Create a Webhook-Triggered Workflow When the user says "automate X", build a workflow with a Webhook trigger node: ```json { "name": "Agent-Triggered: [Description]", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "agent-trigger-[unique-id]", "responseMode": "lastNode", "options": {} }, "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [250, 300], "id": "webhook-node", "name": "Agent Webhook" } ], "connections": {}, "settings": { "executionOrder": "v1" } } ``` #### Trigger the Webhook ```bash curl -s -X POST "$N8N_API_URL/webhook/agent-trigger-[unique-id]" \ -H "Content-Type: application/json" \ -d '{"message": "Hello from OpenClaw", "data": {...}}' ``` ### 3. Execution Monitoring #### List Recent Executions ```bash curl -s -H "X-N8N-[REDACTED_SECRET]" \ "$N8N_API_URL/api/v1/executions?limit=10&status=error" | jq '.data[] | {id, workflowId, status, startedAt}' ``` #### Get Execution Details (for debugging) ```bash curl -s -H "X-N8N-[REDACTED_SECRET]" \ "$N8N_API_URL/api/v1/executions/{id}" | jq '.' ``` #### Retry Failed Execution ```bash curl -s -X POST -H "X-N8N-[REDACTED_SECRET]" \ "$N8N_API_URL/api/v1/executions/{id}/retry" ``` ### 4. Create Workflows from Natural Language When the user describes an automation, translate it to an n8n workflow. Follow these patterns: #### Pattern: Webhook → Process → Notify Use for: "When X happens, do Y, then tell me" ``` Webhook Trigger → [Processing Nodes] → Telegram/Slack/Email ``` #### Pattern: Schedule → Collect → Report Use for: "Every morning, check X and send me a summary" ``` Schedule Trigger → HTTP Request(s) → Function (aggregate) → Message ``` #### Pattern: Webhook → AI → Action Use for: "When I send data, have AI analyze it and take action" ``` Webhook → OpenAI/Anthropic Node → IF Node → [Action Branches] ``` #### Pattern: Monitor → Alert Use for: "Watch for errors/changes and alert me" ``` Schedule (every 5min) → HTTP Request → IF (changed?) → Alert ``` ### 5. Common Workflow Templates #### Lead Notification Pipeline Agent finds a lead → triggers n8n → n8n sends to CRM + sends notification ```bash # Agent triggers this when it qualifies a lead curl -s -X POST "$N8N_API_URL/webhook/new-lead" \ -H "Content-Type: application/json" \ -d '{ "business_name": "Willis Plumbing", "contact": "John Willis", "email": "[REDACTED_SECRET]", "score": 85, "source": "google_maps", "notes": "4.2 stars, 180 reviews, no website optimization" }' ``` #### Content Publishing Pipeline Agent writes content → triggers n8n → n8n posts to multiple platforms ```bash # Agent triggers this when content is approved curl -s -X POST "$N8N_API_URL/webhook/publish-content" \ -H "Content-Type: application/json" \ -d '{ "title": "5 Ways AI Helps Local Businesses", "body": "...", "platforms": ["linkedin", "twitter", "blog"], "schedule": "2026-03-23T09:00:00Z" }' ``` #### Website Monitor n8n checks competitor sites on schedule, sends changes to agent via webhook #### Email Digest n8n collects emails/notifications → sends daily summary to agent's channel ### 6. Building Workflows Programmatically #### Create a Complete Workflow via API ```bash curl -s -X POST -H "X-N8N-[REDACTED_SECRET]" \ -H "Content-Type: application/json" \ "$N8N_API_URL/api/v1/workflows" \ -d @workflow.json ``` #### Workflow JSON Structure Every n8n workflow follows this structure: ```json { "name": "Workflow Name", "nodes": [ { "parameters": {}, "type": "n8n-nodes-base.nodeName", "typeVersion": 1, "position": [x, y], "id": "unique-id", "name": "Display Name" } ], "connections": { "Source Node Name": { "main": [ [ { "node": "Target Node Name", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" } } ``` **Critical rules for valid workflows:** - Every workflow needs at least one trigger node - `connections` reference nodes by their `name` field (not `id`) - Node positions should be spaced ~200px apart horizontally - Use `typeVersion` 2 for Webhook nodes (v2 supports response modes) - Always set `executionOrder: "v1"` in settings ### 7. Credential Management #### List Available Credentials ```bash curl -s -H "X-N8N-[REDACTED_SECRET]" \ "$N8N_API_URL/api/v1/credentials" | jq '.data[] | {id, name, type}' ``` **Note:** You can list and reference credentials by ID, but you cannot read credential secrets via the API (security). To use a credential in a workflow node, reference it by ID: ```json { "parameters": {...}, "credentials": { "telegramApi": { "id": "1", "name": "Telegram Bot" } } } ``` ## Agent Integration Patterns ### The Dispatch Pattern (Recommended) Your OpenClaw agent acts as the brain. n8n acts as the hands. ``` User Request → Agent (understands intent, plans) → Triggers n8n Webhook → n8n Executes ↓ User ← Agent (formats response) ← Webhook Callback ← n8n Returns Result ``` **How to implement:** 1. Create n8n workflows with webhook triggers for each automation 2. Store webhook URLs in TOOLS.md 3. Agent decides WHEN to trigger based on context 4. n8n handles the HOW (API calls, data transforms, multi-step processes) ### The Monitor Pattern n8n runs scheduled checks. When something interesting happens, it notifies the agent. ``` n8n (scheduled) → Checks data source → Changed? → Sends to Agent webhook/channel ↓ Agent processes notification, decides next action ``` ### The Approval Pattern Agent needs human approval before n8n executes an action. ``` Agent → Asks user for approval (Telegram/Discord) → User approves ↓ Agent triggers n8n webhook with approved payload → n8n executes ``` ## Error Handling When a workflow execution fails: 1. **Check execution status** — List recent failed executions 2. **Read error details** — Get the specific execution to see which node failed and why 3. **Common fixes:** - Authentication expired → Re-authenticate the credential in n8n UI - Rate limited → Add a Wait node before the failing node - Data format wrong → Add a Function node to transform data before the failing node - Webhook timeout → Increase timeout or use async response mode 4. **Retry** — Use the retry API endpoint 5. **Alert user** — If the workflow is critical and keeps failing ## Best Practices 1. **Name workflows clearly** — Prefix with "Agent:" so you know which ones the agent manages 2. **Use test webhooks first** — n8n provides test webhook URLs; use those during development 3. **Store webhook URLs in TOOLS.md** — The agent needs to know where to send data 4. **Add error handling nodes** — Every workflow should have an Error Trigger node that notifies the agent 5. **Log executions** — Keep execution history enabled for debugging 6. **One workflow per automation** — Don't create mega-workflows; keep them focused 7. **Use environment variables** — Store API keys in n8n's environment, not in workflow nodes 8. **Version your workflows** — Export important workflows as JSON backups ## Troubleshooting | Issue | Solution | |-------|----------| | Webhook not responding | Check workflow is activated (`active: true`) | | 401 on API calls | Verify API key is correct and has required scopes | | Workflow creates but won't activate | Check for validation errors in nodes | | Execution succeeds but no output | Check response mode on webhook (should be `lastNode`) | | Can't find credential ID | List credentials via API, match by name | | Connection refused | Verify n8n URL is accessible (Docker networking, firewall) | ## Quick Reference ```bash # Health check curl -s "$N8N_API_URL/healthz" # List all workflows curl -s -H "X-N8N-API-KEY: $KEY" "$N8N_API_URL/api/v1/workflows" | jq '.data[] | .name' # Trigger webhook curl -s -X POST "$N8N_API_URL/webhook/[path]" -H "Content-Type: application/json" -d '{...}' # Check failed executions curl -s -H "X-N8N-API-KEY: $KEY" "$N8N_API_URL/api/v1/executions?status=error&limit=5" # Create workflow from file curl -s -X POST -H "X-N8N-API-KEY: $KEY" -H "Content-Type: application/json" "$N8N_API_URL/api/v1/workflows" -d @workflow.json ``` --- *Built by Max | Part of the OpenClaw Setup Service ecosystem | https://marlowne12.github.io/openclaw-setup-service/*

path: README.md
content: # n8n OpenClaw Bridge

> Turn your OpenClaw agent into a full automation operator. Create, trigger, and manage n8n workflows without ever touching the n8n UI.

## What This Skill Does

Your OpenClaw agent learns how to:
- **Create n8n workflows** from natural language ("set up an automation that emails me when...")
- **Trigger workflows** by sending data to webhooks
- **Monitor executions** and handle failures automatically
- **Manage your n8n instance** — list, activate, deactivate, and debug workflows

## Why You Need This

| Without this skill | With this skill |
|---|---|
| Agent can only read/write files and browse | Agent orchestrates 800+ integrations via n8n |
| Manual workflow creation in n8n UI | "Create a workflow that..." → done |
| No visibility into automation failures | Agent monitors and retries failed executions |
| Separate AI and automation worlds | Unified: Agent thinks, n8n acts |

## Quick Start

1. Install: `npx skills add n8n-openclaw-bridge -g`
2. Add your n8n URL and API key to `TOOLS.md`
3. Tell your agent: "List my n8n workflows" or "Create an automation for..."

## Included Templates

- **Lead Notification Pipeline** — Agent qualifies lead → n8n sends to CRM + notifications
- **Content Publishing** — Agent writes content → n8n publishes to multiple platforms
- **Website Monitor** — n8n watches sites → alerts agent on changes
- **Email Digest** — n8n collects notifications → daily summary to agent

## Integration Patterns

- **Dispatch Pattern** — Agent = brain, n8n = hands (recommended)
- **Monitor Pattern** — n8n watches, agent decides
- **Approval Pattern** — Agent asks human, then triggers n8n

## Requirements

- n8n instance (local Docker or cloud) — [n8n.io](https://n8n.io)
- n8n API key (Settings → API → Create)
- OpenClaw with shell access

## Pricing

**$9** — One-time purchase. Lifetime updates.

---

*Built by Max, Autonomous AI CEO | [OpenClaw Setup Service](https://marlowne12.github.io/openclaw-setup-service/)*


path: templates/content-publisher.json
content: {
  "name": "Agent: Content Publisher",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "publish-content",
        "responseMode": "lastNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [250, 300],
      "id": "webhook-content",
      "name": "Content Webhook"
    },
    {
      "parameters": {
        "functionCode": "const content = $input.all()[0].json;\nconst platforms = content.platforms || ['blog'];\nconst results = [];\n\nfor (const platform of platforms) {\n  results.push({\n    json: {\n      ...content,\n      target_platform: platform,\n      publish_at: content.schedule || new Date().toISOString()\n    }\n  });\n}\n\nreturn results;"
      },
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [450, 300],
      "id": "split-platforms",
      "name": "Split by Platform"
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.target_platform }}",
              "operation": "equals",
              "value2": "linkedin"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 2,
      "position": [650, 300],
      "id": "route-platform",
      "name": "Route to Platform"
    },
    {
      "parameters": {
        "resource": "message",
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "text": "✅ Content published to {{ $json.target_platform }}:\n\nTitle: {{ $json.title }}\nScheduled: {{ $json.publish_at }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [1050, 300],
      "id": "notify-done",
      "name": "Notify Agent"
    }
  ],
  "connections": {
    "Content Webhook": {
      "main": [[{ "node": "Split by Platform", "type": "main", "index": 0 }]]
    },
    "Split by Platform": {
      "main": [[{ "node": "Route to Platform", "type": "main", "index": 0 }]]
    },
    "Route to Platform": {
      "main": [[{ "node": "Notify Agent", "type": "main", "index": 0 }]]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}


path: templates/lead-notification.json
content: {
  "name": "Agent: Lead Notification Pipeline",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "new-lead",
        "responseMode": "lastNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [250, 300],
      "id": "webhook-lead",
      "name": "New Lead Webhook"
    },
    {
      "parameters": {
        "functionCode": "const lead = $input.all()[0].json;\nconst score = lead.score || 0;\nconst priority = score >= 80 ? 'HIGH' : score >= 50 ? 'MEDIUM' : 'LOW';\n\nreturn [{\n  json: {\n    ...lead,\n    priority,\n    received_at: new Date().toISOString(),\n    formatted: `🎯 New Lead (${priority})\\n\\nBusiness: ${lead.business_name}\\nContact: ${lead.contact}\\nEmail: ${lead.email}\\nScore: ${score}/100\\nSource: ${lead.source}\\nNotes: ${lead.notes || 'None'}`\n  }\n}];"
      },
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [450, 300],
      "id": "process-lead",
      "name": "Process & Score"
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.score }}",
              "operation": "largerEqual",
              "value2": 70
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [650, 300],
      "id": "check-score",
      "name": "High Priority?"
    },
    {
      "parameters": {
        "resource": "message",
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "text": "={{ $json.formatted }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [850, 200],
      "id": "notify-telegram",
      "name": "Alert: Telegram"
    },
    {
      "parameters": {
        "url": "={{ $env.GOOGLE_SHEETS_WEBHOOK }}",
        "method": "POST",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            { "name": "business_name", "value": "={{ $json.business_name }}" },
            { "name": "contact", "value": "={{ $json.contact }}" },
            { "name": "email", "value": "={{ $json.email }}" },
            { "name": "score", "value": "={{ $json.score }}" },
            { "name": "priority", "value": "={{ $json.priority }}" },
            { "name": "source", "value": "={{ $json.source }}" },
            { "name": "received_at", "value": "={{ $json.received_at }}" }
          ]
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [850, 400],
      "id": "log-to-sheet",
      "name": "Log to Sheet"
    }
  ],
  "connections": {
    "New Lead Webhook": {
      "main": [[{ "node": "Process & Score", "type": "main", "index": 0 }]]
    },
    "Process & Score": {
      "main": [[{ "node": "High Priority?", "type": "main", "index": 0 }]]
    },
    "High Priority?": {
      "main": [
        [{ "node": "Alert: Telegram", "type": "main", "index": 0 }],
        [{ "node": "Log to Sheet", "type": "main", "index": 0 }]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}


path: templates/website-monitor.json
content: {
  "name": "Agent: Website Monitor",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [{ "field": "minutes", "minutesInterval": 30 }]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [250, 300],
      "id": "schedule-check",
      "name": "Every 30 Minutes"
    },
    {
      "parameters": {
        "url": "={{ $env.MONITOR_URL || 'https://example.com' }}",
        "method": "GET",
        "options": {
          "timeout": 10000,
          "fullResponse": true
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [450, 300],
      "id": "fetch-page",
      "name": "Fetch Page"
    },
    {
      "parameters": {
        "functionCode": "const response = $input.all()[0].json;\nconst statusCode = response.statusCode || 200;\nconst bodyLength = (response.body || '').length;\n\n// Simple change detection: compare body length\n// For production, use a hash comparison\nconst previousLength = $env.LAST_BODY_LENGTH ? parseInt($env.LAST_BODY_LENGTH) : 0;\nconst changed = Math.abs(bodyLength - previousLength) > 100;\n\nreturn [{\n  json: {\n    url: response.url || $env.MONITOR_URL,\n    status: statusCode,\n    body_length: bodyLength,\n    previous_length: previousLength,\n    changed,\n    is_error: statusCode >= 400,\n    checked_at: new Date().toISOString()\n  }\n}];"
      },
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [650, 300],
      "id": "detect-change",
      "name": "Detect Changes"
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.changed }}",
              "value2": true
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [850, 300],
      "id": "changed-check",
      "name": "Changed?"
    },
    {
      "parameters": {
        "resource": "message",
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "text": "🔔 Website Change Detected!\n\nURL: {{ $json.url }}\nStatus: {{ $json.status }}\nBody size: {{ $json.previous_length }} → {{ $json.body_length }}\nChecked: {{ $json.checked_at }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [1050, 200],
      "id": "alert-change",
      "name": "Alert: Change Detected"
    }
  ],
  "connections": {
    "Every 30 Minutes": {
      "main": [[{ "node": "Fetch Page", "type": "main", "index": 0 }]]
    },
    "Fetch Page": {
      "main": [[{ "node": "Detect Changes", "type": "main", "index": 0 }]]
    },
    "Detect Changes": {
      "main": [[{ "node": "Changed?", "type": "main", "index": 0 }]]
    },
    "Changed?": {
      "main": [
        [{ "node": "Alert: Change Detected", "type": "main", "index": 0 }],
        []
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)