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.
Use this skill when:
Triggers: "create a workflow", "trigger automation", "n8n workflow", "automate this process", "set up a webhook", "monitor my workflows", "workflow failed"
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"
bash
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" "$N8N_API_URL/api/v1/workflows" | jq '.data[] | {id, name, active}'
bash
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" "$N8N_API_URL/api/v1/workflows/{id}" | jq '.'
bash
# Activate
curl -s -X PATCH -H "X-N8N-API-KEY: $N8N_API_KEY" -H "Content-Type: application/json" \
-d '{"active": true}' "$N8N_API_URL/api/v1/workflows/{id}"
# Deactivate
curl -s -X PATCH -H "X-N8N-API-KEY: $N8N_API_KEY" -H "Content-Type: application/json" \
-d '{"active": false}' "$N8N_API_URL/api/v1/workflows/{id}"
bash
curl -s -X DELETE -H "X-N8N-API-KEY: $N8N_API_KEY" "$N8N_API_URL/api/v1/workflows/{id}"
The most common pattern: your agent triggers an n8n workflow by sending data to a webhook.
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"
}
}
bash
curl -s -X POST "$N8N_API_URL/webhook/agent-trigger-[unique-id]" \
-H "Content-Type: application/json" \
-d '{"message": "Hello from OpenClaw", "data": {...}}'
bash
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
"$N8N_API_URL/api/v1/executions?limit=10&status=error" | jq '.data[] | {id, workflowId, status, startedAt}'
bash
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
"$N8N_API_URL/api/v1/executions/{id}" | jq '.'
bash
curl -s -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" \
"$N8N_API_URL/api/v1/executions/{id}/retry"
When the user describes an automation, translate it to an n8n workflow. Follow these patterns:
Use for: "When X happens, do Y, then tell me"
text
Webhook Trigger → [Processing Nodes] → Telegram/Slack/Email
Use for: "Every morning, check X and send me a summary"
text
Schedule Trigger → HTTP Request(s) → Function (aggregate) → Message
Use for: "When I send data, have AI analyze it and take action"
text
Webhook → OpenAI/Anthropic Node → IF Node → [Action Branches]
Use for: "Watch for errors/changes and alert me"
text
Schedule (every 5min) → HTTP Request → IF (changed?) → Alert
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": "john@willisplumbing.com",
"score": 85,
"source": "google_maps",
"notes": "4.2 stars, 180 reviews, no website optimization"
}'
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"
}'
n8n checks competitor sites on schedule, sends changes to agent via webhook
n8n collects emails/notifications → sends daily summary to agent's channel
bash
curl -s -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json" \
"$N8N_API_URL/api/v1/workflows" \
-d @workflow.json
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:
connections reference nodes by their name field (not id)typeVersion 2 for Webhook nodes (v2 supports response modes)executionOrder: "v1" in settingsbash
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
"$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"
}
}
}
Your OpenClaw agent acts as the brain. n8n acts as the hands.
text
User Request → Agent (understands intent, plans) → Triggers n8n Webhook → n8n Executes
↓
User ← Agent (formats response) ← Webhook Callback ← n8n Returns Result
How to implement:
n8n runs scheduled checks. When something interesting happens, it notifies the agent.
text
n8n (scheduled) → Checks data source → Changed? → Sends to Agent webhook/channel
↓
Agent processes notification, decides next action
Agent needs human approval before n8n executes an action.
text
Agent → Asks user for approval (Telegram/Discord) → User approves
↓
Agent triggers n8n webhook with approved payload → n8n executes
When a workflow execution fails:
IssueSolutionWebhook not respondingCheck workflow is activated ( active: true)401 on API callsVerify API key is correct and has required scopesWorkflow creates but won't activateCheck for validation errors in nodesExecution succeeds but no outputCheck response mode on webhook (should be lastNode)Can't find credential IDList credentials via API, match by nameConnection refusedVerify n8n URL is accessible (Docker networking, firewall)
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/