n8n Workflow Builder
Setup
Requires two environment variables:
N8N_URL — n8n instance URL (e.g. https://your-n8n.example.com)
N8N_API_KEY — n8n API key (Settings → API → Create API Key)
Workflow
Understand the automation — Clarify trigger (webhook/schedule/manual), data sources, processing logic, outputs, and error handling needs.
Design the workflow JSON — Build valid n8n workflow JSON following the schema in references/workflow-schema.md. Use patterns from references/workflow-patterns.md as templates.
Deploy via API — Use scripts/n8n-api.sh create <file> or pipe JSON to scripts/n8n-api.sh create-stdin.
Activate — Use scripts/n8n-api.sh activate <workflow_id> for trigger-based workflows.
Verify — List workflows to confirm deployment: scripts/n8n-api.sh list.
API Script Reference
# List all workflows
scripts/n8n-api.sh list
# Create workflow from JSON file
scripts/n8n-api.sh create /tmp/workflow.json
# Create from stdin
echo '{"name":"Test",...}' | scripts/n8n-api.sh create-stdin
# Get, activate, deactivate, delete, execute
scripts/n8n-api.sh get <id>
scripts/n8n-api.sh activate <id>
scripts/n8n-api.sh deactivate <id>
scripts/n8n-api.sh delete <id>
scripts/n8n-api.sh execute <id>
# List credentials and tags
scripts/n8n-api.sh credentials
scripts/n8n-api.sh tags
Building Workflow JSON
Every workflow needs: name, nodes[], connections{}, settings{}.
Every node needs: id, name, type, typeVersion, position, parameters.
Connections use source node display name as key, mapping outputs to target nodes.
For full schema, node types, and expression syntax → read references/workflow-schema.md
For complete workflow examples (webhook, schedule, AI agent, DB sync, error handling) → read references/workflow-patterns.md
Key Rules
- Always set
"executionOrder": "v1" in settings
- Node names must be unique within a workflow
- Node IDs must be unique — use descriptive slugs like
webhook1, code1
- Position nodes starting at
[250, 300], spacing ~200px horizontally
- IF nodes have two outputs: index 0 = true, index 1 = false
- Webhook workflows need
respondToWebhook node if responseMode is responseNode
- Credentials must exist in n8n before activation — check with
scripts/n8n-api.sh credentials
- Test before activating — use
scripts/n8n-api.sh execute <id> for manual trigger workflows
- Use
continueOnFail: true on risky HTTP/API nodes, then check for errors downstream
Common Real Estate Workflows
- Lead intake: Webhook → validate → dedupe → insert DB → notify Slack/SMS
- Call follow-up: Schedule → query DB for completed calls → send SMS/email based on outcome
- Drip campaign: Schedule → query leads by stage → send stage-appropriate email/SMS
- CRM sync: Webhook → transform → update HubSpot/Salesforce + internal DB
- Property alerts: Schedule → scrape/API listings → filter new → notify leads
- AI qualification: Webhook → AI Agent (classify lead intent) → route to appropriate pipeline
1---2name: n8n-builder3description: Expert n8n workflow builder that creates, deploys, and manages n8n workflows programmatically via the n8n REST API. Use when asked to create n8n workflows, automate n8n tasks, build automations, design workflow pipelines, connect services via n8n, or manage existing n8n workflows. Handles webhook flows, scheduled tasks, AI agents, database syncs, conditional logic, error handling, and any n8n node configuration.4---5
6# n8n Workflow Builder
7
8## Setup
9
10Requires two environment variables:
11- `N8N_URL` — n8n instance URL (e.g. `https://your-n8n.example.com`)
12- `N8N_API_KEY` — n8n API key (Settings → API → Create API Key)
13
14## Workflow
15
161. **Understand the automation** — Clarify trigger (webhook/schedule/manual), data sources, processing logic, outputs, and error handling needs.
17
182. **Design the workflow JSON** — Build valid n8n workflow JSON following the schema in `references/workflow-schema.md`. Use patterns from `references/workflow-patterns.md` as templates.
19
203. **Deploy via API** — Use `scripts/n8n-api.sh create <file>` or pipe JSON to `scripts/n8n-api.sh create-stdin`.
21
224. **Activate** — Use `scripts/n8n-api.sh activate <workflow_id>` for trigger-based workflows.
23
245. **Verify** — List workflows to confirm deployment: `scripts/n8n-api.sh list`.
25
26## API Script Reference
27
28```bash
29# List all workflows
30scripts/n8n-api.sh list
31
32# Create workflow from JSON file
33scripts/n8n-api.sh create /tmp/workflow.json
34
35# Create from stdin
36echo '{"name":"Test",...}' | scripts/n8n-api.sh create-stdin
37
38# Get, activate, deactivate, delete, execute
39scripts/n8n-api.sh get <id>
40scripts/n8n-api.sh activate <id>
41scripts/n8n-api.sh deactivate <id>
42scripts/n8n-api.sh delete <id>
43scripts/n8n-api.sh execute <id>
44
45# List credentials and tags
46scripts/n8n-api.sh credentials
47scripts/n8n-api.sh tags
48```
49
50## Building Workflow JSON
51
52Every workflow needs: `name`, `nodes[]`, `connections{}`, `settings{}`.
53
54Every node needs: `id`, `name`, `type`, `typeVersion`, `position`, `parameters`.
55
56Connections use **source node display name** as key, mapping outputs to target nodes.
57
58For full schema, node types, and expression syntax → read `references/workflow-schema.md`
59For complete workflow examples (webhook, schedule, AI agent, DB sync, error handling) → read `references/workflow-patterns.md`
60
61## Key Rules
62
63- **Always set `"executionOrder": "v1"`** in settings
64- **Node names must be unique** within a workflow
65- **Node IDs must be unique** — use descriptive slugs like `webhook1`, `code1`
66- **Position nodes** starting at `[250, 300]`, spacing ~200px horizontally
67- **IF nodes** have two outputs: index 0 = true, index 1 = false
68- **Webhook workflows** need `respondToWebhook` node if `responseMode` is `responseNode`
69- **Credentials** must exist in n8n before activation — check with `scripts/n8n-api.sh credentials`
70- **Test before activating** — use `scripts/n8n-api.sh execute <id>` for manual trigger workflows
71- **Use `continueOnFail: true`** on risky HTTP/API nodes, then check for errors downstream
72
73## Common Real Estate Workflows
74
75- **Lead intake**: Webhook → validate → dedupe → insert DB → notify Slack/SMS
76- **Call follow-up**: Schedule → query DB for completed calls → send SMS/email based on outcome
77- **Drip campaign**: Schedule → query leads by stage → send stage-appropriate email/SMS
78- **CRM sync**: Webhook → transform → update HubSpot/Salesforce + internal DB
79- **Property alerts**: Schedule → scrape/API listings → filter new → notify leads
80- **AI qualification**: Webhook → AI Agent (classify lead intent) → route to appropriate pipeline