n8n Bridge
Bi-directional integration between OpenClaw agents and n8n workflow automation platform.
Quick Start
# Configure n8n connection
python3 scripts/n8n-bridge.py config --url http://localhost:5678 --api-key YOUR_N8N_API_KEY
# Trigger a workflow by name
python3 scripts/n8n-bridge.py trigger --workflow "daily-report" --data '{"date": "2026-03-29"}'
# List available workflows
python3 scripts/n8n-bridge.py list
# Start webhook listener (receive callbacks from n8n)
python3 scripts/n8n-bridge.py listen --port 9876
# Check connection status
python3 scripts/n8n-bridge.py status
# Apply a pre-built template
python3 scripts/n8n-bridge.py template --name "crm-sync" --apply
Commands
`config` — Configure Connection
Set up n8n API connection:
--url URL— n8n instance URL (required)--api-key KEY— n8n API key (required)--save— Persist to config file (default: memory/n8n-config.json)--test— Test connection immediately
`trigger` — Execute Workflow
Trigger an n8n workflow with optional data:
--workflow NAME_OR_ID— Workflow name or numeric ID (required)--data JSON— Input data as JSON string--data-file PATH— Input data from JSON file--wait— Wait for workflow completion and return result--timeout SECS— Max wait time (default: 120)
`list` — List Workflows
Show all available n8n workflows:
--active— Only show active workflows--tag TAG— Filter by tag--format text|json— Output format
`listen` — Webhook Listener
Start a lightweight HTTP server to receive n8n webhook callbacks:
--port PORT— Listen port (default: 9876)--callback SCRIPT— Script to run on webhook receipt--log PATH— Log received events to file- Received payloads are written to
memory/n8n-events.json
`status` — Connection Status
Check n8n instance health and API connectivity:
- Tests API authentication
- Reports n8n version
- Shows active workflow count
- Checks webhook listener status
`template` — Pre-built Templates
Deploy ready-made workflow configurations:
--name NAME— Template name (see below)--list— Show all available templates--apply— Import template into n8n (creates workflow)--preview— Show template details without importing
`history` — Execution History
View recent workflow execution results:
--workflow NAME_OR_ID— Filter by workflow--limit N— Number of results (default: 10)--status success|error|waiting— Filter by status
Pre-built Templates
| Template | Description | Triggers |
|----------|-------------|----------|
| crm-sync | Sync contacts between CRM and spreadsheet | Webhook, Schedule |
| email-automation | Auto-categorize and route emails | Email trigger |
| data-pipeline | ETL from API → transform → database | Schedule, Webhook |
| slack-alerts | Route OpenClaw alerts to Slack channels | Webhook |
| invoice-processor | Extract data from invoice PDFs | Webhook with file |
| social-poster | Cross-post content to social platforms | Webhook |
| backup-runner | Automated backups to cloud storage | Schedule |
| lead-scorer | Score incoming leads with AI analysis | Webhook |
Data Flow Architecture
OpenClaw Agent n8n Instance
│ │
├─── trigger ──────────────────► │ (Webhook/API)
│ ├─── Execute workflow
│ ├─── Process steps
│ ◄── callback (webhook) ────── ├─── Return results
│ │
├─── listen (webhook server) ◄── │ (n8n HTTP Request node)
│ │
Configuration File
Stored at memory/n8n-config.json:
{
"url": "http://localhost:5678",
"api_key": "n8n_api_...",
"webhook_port": 9876,
"default_timeout": 120,
"templates_dir": "skills/n8n-bridge/references/templates"
}
Requirements
- n8n instance (self-hosted or n8n.cloud)
- n8n API key (Settings → API → Create API Key)
- Python 3.10+ with
requestslibrary (included in most environments) - For webhook listener: accessible port from n8n instance