p
N8n 1.0.2
Scanned@pntrivedy
npx machina-cli add skill @pntrivedy/n8n-1-0-2 --openclawFiles (1)
SKILL.md
3.1 KB
n8n Workflow Management
Interact with n8n automation platform via REST API.
Setup
First-time setup:
- Install dependencies (virtual environment):
cd skills/n8n-1.0.2
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
- Configure environment variables in
~/.zshrc(or~/.bashrc):
export N8N_API_KEY="your-api-key-here"
export N8N_BASE_URL="https://your-n8n-instance.com"
- Reload shell and verify connection:
source ~/.zshrc
./skills/n8n-1.0.2/scripts/n8n.sh list-workflows --pretty
Tip: Get your API key from n8n UI: Settings → API
Quick Reference
List Workflows
./scripts/n8n.sh list-workflows --pretty
./scripts/n8n.sh list-workflows --active true --pretty
Get Workflow Details
./scripts/n8n.sh get-workflow --id <workflow-id> --pretty
Activate/Deactivate
./scripts/n8n.sh activate --id <workflow-id>
./scripts/n8n.sh deactivate --id <workflow-id>
Executions
# List recent executions
./scripts/n8n.sh list-executions --limit 10 --pretty
# Get execution details
./scripts/n8n.sh get-execution --id <execution-id> --pretty
# Filter by workflow
./scripts/n8n.sh list-executions --id <workflow-id> --limit 20 --pretty
Manual Execution
# Trigger workflow
./scripts/n8n.sh execute --id <workflow-id>
# With data
./scripts/n8n.sh execute --id <workflow-id> --data '{"key": "value"}'
Python API
For programmatic access:
from scripts.n8n_api import N8nClient
client = N8nClient()
# List workflows
workflows = client.list_workflows(active=True)
# Get workflow
workflow = client.get_workflow('workflow-id')
# Activate/deactivate
client.activate_workflow('workflow-id')
client.deactivate_workflow('workflow-id')
# Executions
executions = client.list_executions(workflow_id='workflow-id', limit=10)
execution = client.get_execution('execution-id')
# Execute workflow
result = client.execute_workflow('workflow-id', data={'key': 'value'})
Common Tasks
Debug Failed Workflows
- List recent executions with failures
- Get execution details to see error
- Check workflow configuration
- Deactivate if needed
Monitor Workflow Health
- List active workflows
- Check recent execution status
- Review error patterns
Workflow Management
- List all workflows
- Review active/inactive status
- Activate/deactivate as needed
- Delete old workflows
API Reference
For detailed API documentation, see references/api.md.
Troubleshooting
Authentication error:
- Verify N8N_API_KEY is set:
echo $N8N_API_KEY - Check API key is valid in n8n UI
Connection error:
- Check N8N_BASE_URL if using custom URL
Command errors:
- Use
--prettyflag for readable output - Check
--idis provided when required - Validate JSON format for
--dataparameter
Overview
This skill lets you control n8n automation workflows and their executions through REST API. It covers listing workflows, activating/deactivating, inspecting executions, triggering runs manually, and debugging automation issues.
How This Skill Works
The skill uses the n8n REST endpoints via a Python client (N8nClient) or shell scripts. You can list workflows, fetch workflow details, activate/deactivate workflows, view executions, and execute workflows with optional data.
When to Use It
- Need to list, inspect, or monitor workflows and executions from an external app
- Automate workflow activation/deactivation or status checks as part of a runbook
- Manually trigger a workflow or pass JSON data to a run for testing
- Debug failed workflows by retrieving recent executions and error details
- Prepare automated health checks by regularly listing workflows and executions
Quick Start
- Step 1: Install dependencies, create a virtual environment, and set N8N_API_KEY and N8N_BASE_URL
- Step 2: Use CLI to list workflows and inspect IDs (e.g., list-workflows, get-workflow)
- Step 3: Trigger or schedule runs via CLI or Python API (execute or N8nClient.execute_workflow)
Best Practices
- Secure API access: store N8N_API_KEY safely and rotate as needed
- Configure N8N_BASE_URL correctly and verify the connection before calls
- Prefer --pretty output and --id when filtering results for clarity
- Validate and serialize JSON payload passed to execute --data
- Test changes in a staging environment before applying to production workflows
Example Use Cases
- List active workflows and fetch details to plan updates
- Trigger a workflow with data: {'key':'value'} and verify execution
- Get execution details for a failed run to identify the error
- Activate a workflow after updating its configuration
- Deactivate outdated workflows to reduce runtime noise
Frequently Asked Questions
Add this skill to your agents