N8n Api Bridge logo

N8n Api Bridge

Community
MorrisLu-Taipei
n8n-api-bridge

Standard SOP for reading and writing n8n workflows via the n8n REST API — read sticky notes from a workflow, push generated JSON back, list workflows, activate/deactivate, manage executions. Use when the user references a workflow by ID/URL, asks to "deploy" or "push to n8n" or "讀 n8n", or when sticky-note-to-workflow needs to fetch source/write target. Uses raw HTTP REST API only; no MCP dependency.

Overview

PublisherMorrisLu-Taipei
RepositoryTigerAI-A2A-Code2n8n-Skill-Pack
Skill namen8n-api-bridge
Stars
86
Forks
26
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by MorrisLu-Taipei on GitHub. Read the source before you install it.

Installation

Install the N8n Api Bridge AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/MorrisLu-Taipei/TigerAI-A2A-Code2n8n-Skill-Pack/tree/main/skills/tigerai/n8n-api-bridge
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MorrisLu-Taipei/TigerAI-A2A-Code2n8n-Skill-Pack.git /tmp/TigerAI-A2A-Code2n8n-Skill-Pack
mkdir -p .claude/skills
cp -r /tmp/TigerAI-A2A-Code2n8n-Skill-Pack/skills/tigerai/n8n-api-bridge .claude/skills/n8n-api-bridge
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable N8n Api Bridge in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads N8n Api Bridge on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so N8n Api Bridge is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

n8n-api-bridge — n8n REST API 通訊 SOP

🌐 English | 繁體中文

1. 觸發條件

精確:

  • 「讀 n8n workflow」/「讀 workflow ID」
  • 「deploy」/「push to n8n」/「寫回 n8n」
  • 「啟用 / 停用 workflow」
  • 「列出 workflow」

隱式:

  • sticky-note-to-workflow 產出後需寫回 → 自動接力本 Skill
  • 範例查詢模式找到範例後使用者要試跑 → 自動部署

2. 連線設定

預期環境變數:

bash
N8N_API_URL=https://your-n8n.example.com   # 不含結尾斜線
N8N_API_KEY=<api-key>                       # 從 n8n Settings → API 取得

驗證連線:

bash
curl -H "X-N8N-API-KEY: $N8N_API_KEY" "$N8N_API_URL/api/v1/workflows?limit=1"

回 200 + JSON 即正常。


3. n8n REST API 端點對照

本 Pack 直接呼叫 n8n REST API,不依賴任何 MCP server。

操作HTTP 呼叫
列 workflowGET /api/v1/workflows
讀 workflowGET /api/v1/workflows/{id}
建 workflowPOST /api/v1/workflows
改 workflow(局部)PATCH /api/v1/workflows/{id}
全量替換PUT /api/v1/workflows/{id}
啟用POST /api/v1/workflows/{id}/activate
停用POST /api/v1/workflows/{id}/deactivate
刪DELETE /api/v1/workflows/{id}
看 executionGET /api/v1/executions
看 credentialsGET /api/v1/credentials

所有呼叫皆帶 header X-N8N-API-KEY: $N8N_API_KEY。


4. 標準操作流程

4.1 「讀 sticky note → 產 workflow」流程

text
1. GET /api/v1/workflows/{id}
2. 從 nodes[] 抽 type=stickyNote 且 color=4 的節點
3. 連接其 parameters.content(多張依 position.x 排序)
4. 把 content 餵給 sticky-note-to-workflow
5. 取得新 workflow JSON
6. PUT /api/v1/workflows/{id}(body: {name, nodes, connections, settings})
   ↑ 注意:Layer 1 sticky 必須保留,只新增/替換 Layer 2 + Layer 3

4.2 「合併寫回」核心規則

寫回 n8n 時,禁止直接覆蓋使用者的 Layer 1:

javascript
// pseudo
const existing = await get(id);
const userLayer1 = existing.nodes.filter(n => n.type === 'stickyNote' && n.parameters.color === 4);
const aiLayer2 = generatedNodes.filter(n => n.type !== 'stickyNote');
const aiLayer3 = generatedNodes.filter(n => n.type === 'stickyNote' && n.parameters.color === 5);

const merged = {
  ...existing,
  nodes: [...userLayer1, ...aiLayer2, ...aiLayer3],
  connections: generatedConnections,  // 連線全替換(不含 sticky)
};
await updateFull(id, merged);

4.3 「冪等性」規則

同一 workflow 多次呼叫 AI 產出時:

  • 若已存在 color=5 的 Layer 3 sticky → 要求使用者確認覆寫(spec three-layer.md §7 第 3 條)
  • 寫回前先 GET 取得當前 JSON 並備份至本地,提供 rollback
  • 寫回後對該 workflow ID 呼叫 POST /api/v1/workflows/{id}/activate 觸發 n8n 內建 schema 驗證

5. 錯誤處理

錯誤碼意義AI 處置
401API key 失效提示使用者重新產 key
403權限不足提示需要 owner/admin role
404workflow 不存在提示確認 ID
409衝突(並發修改)重讀 + 重 merge + 重寫
422JSON schema 不合回報具體欄位,由 AI 依錯誤訊息修正後重 PUT
5xxn8n 端錯誤指數退避 retry 3 次(1s/2s/4s)
timeout大 workflow增 timeout 至 60s 重試

5.1 ⚠️ 切勿直接 SQL 改 workflow(v0.9.0 R3 揭露)

n8n 有版本管理:workflow_entity 配合 versionId / activeVersionId / workflow_published_version 表。直接 UPDATE workflow_entity SET nodes=... 不會被 activate 流程採用,造成 webhook path 不一致等怪現象。

規則:

  • ❌ UPDATE n8n.workflow_entity SET nodes = ... — 永遠不要
  • ✅ PUT /api/v1/workflows/{id} 含 { name, nodes, connections, settings } — n8n 會正確 bump version
  • ✅ 寫回前先 GET /api/v1/workflows/{id} 取最新版,修改後再 PUT
  • ✅ Activate / Deactivate 用 POST /api/v1/workflows/{id}/(de)activate

6. 安全約束

  • ❌ 絕不把 API key 寫進 workflow JSON 或 sticky note
  • ❌ 絕不把 N8N_API_URL / KEY 寫進 git commit
  • ✅ 對 production instance 寫回前必須提示使用者確認
  • ✅ 大量批次寫回(>5 workflows)必須 dry-run 預覽

7. 範例:完整讀寫循環

python
# Pseudo-code (純 REST API,無任何 MCP 依賴)
import os, requests
N8N_URL = os.environ['N8N_API_URL']
HEADERS = {'X-N8N-API-KEY': os.environ['N8N_API_KEY']}

def regenerate_workflow_from_sticky(workflow_id):
    # 1. GET 取現有 workflow
    r = requests.get(f"{N8N_URL}/api/v1/workflows/{workflow_id}", headers=HEADERS)
    wf = r.json()

    # 2. 抽 user Layer 1 sticky (color=4)
    user_layer1 = [n for n in wf['nodes']
                   if n['type'] == 'n8n-nodes-base.stickyNote'
                   and n['parameters'].get('color') == 4]
    if not user_layer1:
        raise Exception("No user sticky note (color=4) found")

    layer1_text = "\n\n".join(sorted(user_layer1, key=lambda n: n['position'][0])
                              [0]['parameters']['content'] for n in user_layer1)

    # 3. 呼叫 sticky-note-to-workflow Skill 產出新 nodes (Layer 2 + Layer 3)
    result = invoke_skill('sticky-note-to-workflow', layer1=layer1_text)
    if not result['success']:
        return result['errors']

    # 4. 合併三層(保留 Layer 1)
    merged = merge_three_layers(wf, user_layer1, result['workflow'])

    # 5. PUT 寫回(n8n 自動 schema 驗證)
    requests.put(f"{N8N_URL}/api/v1/workflows/{workflow_id}",
                 headers=HEADERS, json=merged)

    return {'workflow_id': workflow_id, 'status': 'regenerated'}

8. 與其他 Skill 鏈接

  • 被 sticky-note-to-workflow 呼叫:寫回產出
  • 呼叫 n8n-validation-expert:寫回前驗證 JSON schema
  • 被 tigerai-enterprise-patterns 呼叫:企業情境下要求寫回前手動審查

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the N8n Api Bridge AI skill do?

Standard SOP for reading and writing n8n workflows via the n8n REST API — read sticky notes from a workflow, push generated JSON back, list workflows, activate/deactivate, manage executions. Use when the user references a workflow by ID/URL, asks to "deploy" or "push to n8n" or "讀 n8n", or when sticky-note-to-workflow needs to fetch source/write target. Uses raw HTTP REST API only; no MCP dependency.

Why use N8n Api Bridge on TypingMind?

Because you install it once and use it with any model. N8n Api Bridge is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install N8n Api Bridge in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/MorrisLu-Taipei/TigerAI-A2A-Code2n8n-Skill-Pack/tree/main/skills/tigerai/n8n-api-bridge. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use N8n Api Bridge?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with N8n Api Bridge?

As many as you like. As long as a model supports skills, you can use N8n Api Bridge with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the N8n Api Bridge AI skill free?

Yes. It is published on GitHub by MorrisLu-Taipei under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇