n8n
n8n workflow automation patterns and API integration. This skill should be used when creating n8n workflows, using webhooks, managing workflows via REST API, or integrating n8n with MCP servers. Covers workflow JSON structure, node patterns, and automation best practices.
What this skill does
# n8n Workflow Automation Skill
This skill enables creating and managing n8n workflows for automation tasks.
## Prerequisites
n8n instance running with API access:
```bash
N8N_HOST=localhost
N8N_PORT=5678
N8N_API_KEY=your-api-key
```
## Core Concepts
### Workflow Structure
Every n8n workflow is JSON with this structure:
```json
{
"name": "Workflow Name",
"nodes": [],
"connections": {},
"settings": {
"executionOrder": "v1"
}
}
```
### Node Structure
Each node has:
```json
{
"id": "unique-id",
"name": "Display Name",
"type": "n8n-nodes-base.nodetype",
"typeVersion": 1,
"position": [x, y],
"parameters": {},
"credentials": {}
}
```
### Connection Structure
Connections define data flow between nodes:
```json
{
"Source Node": {
"main": [
[{"node": "Target Node", "type": "main", "index": 0}]
]
}
}
```
## Common Workflow Patterns
### 1. Webhook-Triggered Workflow
Creates an HTTP endpoint that triggers workflow execution:
```json
{
"name": "Webhook Handler",
"nodes": [
{
"id": "webhook",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [250, 300],
"webhookId": "my-webhook",
"parameters": {
"path": "my-endpoint",
"httpMethod": "POST",
"responseMode": "responseNode"
}
},
{
"id": "respond",
"name": "Respond",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [450, 300],
"parameters": {
"respondWith": "json",
"responseBody": "={{ $json }}"
}
}
],
"connections": {
"Webhook": {
"main": [[{"node": "Respond", "type": "main", "index": 0}]]
}
}
}
```
Access at: `http://localhost:5678/webhook/my-endpoint`
### 2. HTTP Request Pattern
Make external API calls:
```json
{
"id": "http",
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [450, 300],
"parameters": {
"method": "POST",
"url": "https://api.example.com/endpoint",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "myApiCredential",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify($json) }}"
},
"credentials": {
"myApiCredential": {"id": "cred-id", "name": "My Credential"}
}
}
```
### 3. Conditional Branching (IF Node)
Route data based on conditions:
```json
{
"id": "if",
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [450, 300],
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.status }}",
"rightValue": "success",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
}
}
```
### 4. Loop Over Items (SplitInBatches)
Process items in batches:
```json
{
"id": "batch",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [450, 300],
"parameters": {
"batchSize": 10,
"options": {}
}
}
```
## n8n REST API
### List Workflows
```bash
curl -s "http://localhost:5678/api/v1/workflows" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
```
### Get Workflow
```bash
curl -s "http://localhost:5678/api/v1/workflows/{id}" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
```
### Create Workflow
```bash
curl -s -X POST "http://localhost:5678/api/v1/workflows" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "New Workflow", "nodes": [...], "connections": {...}}'
```
### Update Workflow
```bash
curl -s -X PUT "http://localhost:5678/api/v1/workflows/{id}" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Updated", "nodes": [...], "connections": {...}}'
```
### Activate/Deactivate
```bash
curl -s -X POST "http://localhost:5678/api/v1/workflows/{id}/activate" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
curl -s -X POST "http://localhost:5678/api/v1/workflows/{id}/deactivate" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
```
### Get Executions
```bash
curl -s "http://localhost:5678/api/v1/executions?workflowId={id}&limit=10&includeData=true" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
```
## Expression Syntax
n8n uses expressions for dynamic values:
| Syntax | Description |
|--------|-------------|
| `={{ $json.field }}` | Access current item field |
| `={{ $json.body.param }}` | Access nested field |
| `={{ $('Node Name').item.json.field }}` | Access output from specific node |
| `={{ $input.first().json }}` | First input item |
| `={{ $input.all() }}` | All input items |
| `={{ JSON.stringify($json) }}` | Convert to JSON string |
## Common Node Types
| Node | Type | Purpose |
|------|------|---------|
| Webhook | `n8n-nodes-base.webhook` | HTTP trigger |
| HTTP Request | `n8n-nodes-base.httpRequest` | API calls |
| Respond to Webhook | `n8n-nodes-base.respondToWebhook` | Return HTTP response |
| IF | `n8n-nodes-base.if` | Conditional branching |
| Switch | `n8n-nodes-base.switch` | Multi-way branching |
| Set | `n8n-nodes-base.set` | Transform data |
| Code | `n8n-nodes-base.code` | Custom JavaScript |
| Split In Batches | `n8n-nodes-base.splitInBatches` | Loop processing |
| Merge | `n8n-nodes-base.merge` | Combine branches |
## MCP Integration
n8n can expose workflows as MCP tools via the built-in MCP server:
1. Enable MCP in workflow settings: `"availableInMCP": true`
2. Access MCP endpoint: `http://localhost:5678/mcp-server/http`
3. Use supergateway for Claude Code integration
## Tips
1. **Webhook Response**: Use `responseMode: "responseNode"` with Respond node for control
2. **Credentials**: Store API keys in n8n credentials, reference by ID
3. **Error Handling**: Add Error Trigger node for failure notifications
4. **Testing**: Use `/webhook-test/` path during development
5. **ADF Format**: Jira/Confluence require Atlassian Document Format for rich text
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.