name: n8n-workflow-generator description: Generate production-ready n8n workflow JSON from natural language descriptions. Describe what you want to automate, and get importable n8n JSON with proper node connections, error handling, and credential placeholders. Supports webhooks, schedules, API calls, AI nodes, and conditional logic.
n8n Workflow Generator
Generate complete, importable n8n workflow JSON from a natural language description of what you want to automate.
Steps
1. Understand the Automation Goal
Ask the user (if not clear from context):
- What should trigger the workflow? (schedule, webhook, manual, event from another app)
- What data needs to be processed? (API responses, form submissions, database records, files)
- What's the desired output? (send email, update database, post to Slack, create document, trigger another workflow)
- Error handling preference? (retry, notify, skip, stop)
If the user gives a brief description (e.g., "send me a Slack message when a new Shopify order comes in"), infer the full pipeline and state assumptions.
2. Design the Workflow Architecture
Before generating JSON, outline the workflow in plain language:
## Workflow Design
**Name**: [descriptive name]
**Trigger**: [trigger type and config]
### Node Pipeline
1. [Trigger Node] → Starts the workflow
2. [Node 2] → [what it does]
3. [Node 3] → [what it does]
├── Success → [Node 4a]
└── Failure → [Error Handler]
4. [Node 4] → [final output]
### Data Flow
- Trigger outputs: { field1, field2, ... }
- Node 2 transforms: { ... } → { ... }
- Node 3 sends to: [destination]
### Credentials Required
- [Service]: [credential type] (e.g., Shopify: API Key, Slack: OAuth2)
Get user confirmation before generating JSON. If the user says "just build it", proceed directly.
3. Generate n8n Workflow JSON
Generate a complete, valid n8n workflow JSON that can be imported via n8n → Workflows → Import from File.
Required JSON structure:
{
"name": "Workflow Name",
"nodes": [
{
"parameters": {},
"id": "unique-uuid",
"name": "Node Name",
"type": "n8n-nodes-base.nodeType",
"typeVersion": 1,
"position": [x, y]
}
],
"connections": {
"Node Name": {
"main": [
[
{
"node": "Next Node Name",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"tags": []
}
Rules for valid n8n JSON:
- Node IDs: Use UUID format (e.g.,
"a1b2c3d4-e5f6-7890-abcd-ef1234567890") - Position: Space nodes vertically by 200px and horizontally by 300px. Start at [250, 300].
- Connections: Reference nodes by
name, notid. Connection index 0 = main output, index 1 = error output (if applicable). - Credential placeholders: Use
"credentials": { "serviceApi": { "id": "REPLACE_WITH_CREDENTIAL_ID", "name": "REPLACE_WITH_CREDENTIAL_NAME" } } - Settings: Always include
"executionOrder": "v1"for modern n8n. - Active: Always set to
false— user activates after testing.
Common Node Types Reference
Triggers:
n8n-nodes-base.scheduleTrigger— Cron/interval schedulen8n-nodes-base.webhook— HTTP webhook endpointn8n-nodes-base.manualTrigger— Manual execution
Data Processing:
n8n-nodes-base.set— Set/transform fieldsn8n-nodes-base.if— Conditional branchingn8n-nodes-base.switch— Multi-way branchingn8n-nodes-base.merge— Merge multiple inputsn8n-nodes-base.splitInBatches— Process items in batchesn8n-nodes-base.code— Custom JavaScript/Python coden8n-nodes-base.filter— Filter items by condition
Communication:
n8n-nodes-base.slack— Slack messagesn8n-nodes-base.emailSend— SMTP emailn8n-nodes-base.telegram— Telegram messages
HTTP/API:
n8n-nodes-base.httpRequest— Generic HTTP requestsn8n-nodes-base.respondToWebhook— Respond to webhook trigger
Data Storage:
n8n-nodes-base.googleSheets— Google Sheets read/writen8n-nodes-base.postgres— PostgreSQL queriesn8n-nodes-base.mySql— MySQL queries
AI (n8n 1.x+):
@n8n/n8n-nodes-langchain.agent— AI Agent with tools@n8n/n8n-nodes-langchain.chainLlm— LLM Chain@n8n/n8n-nodes-langchain.openAi— OpenAI API call
E-commerce:
n8n-nodes-base.shopify— Shopify APIn8n-nodes-base.wooCommerce— WooCommerce API
Error Handling:
n8n-nodes-base.stopAndError— Stop with error messagen8n-nodes-base.noOp— No operation (placeholder)
4. Add Error Handling
Every production workflow should include:
- Try/Catch pattern: Use the Error Trigger node or per-node error output
- Notification on failure: Send Slack/email when workflow fails
- Retry logic: For API calls, add retry on 429/5xx with exponential backoff via the node's retry settings
Add an error notification branch:
{
"parameters": {
"channel": "#alerts",
"text": "Workflow '{{ $workflow.name }}' failed at node '{{ $execution.error.node.name }}': {{ $execution.error.message }}"
},
"name": "Error Notification",
"type": "n8n-nodes-base.slack",
"typeVersion": 2
}
5. Write the JSON to File
Save the generated JSON to a file using the Write tool:
- Filename:
workflow-[descriptive-name].json - Location: Current working directory or user-specified path
- Validate: Ensure the JSON is valid and parseable
6. Provide Import Instructions
## Import Instructions
1. Open your n8n instance
2. Go to Workflows → Import from File
3. Select the generated JSON file
4. Update credential placeholders:
- Look for nodes with "REPLACE_WITH_CREDENTIAL_ID"
- Set up actual credentials in n8n Settings → Credentials
- Assign credentials to each node
5. Test with manual execution first
6. Activate the workflow when ready
### Credentials to Set Up
- [Service 1]: [how to get API key/OAuth]
- [Service 2]: [how to get API key/OAuth]
Edge Cases
- Complex branching (>5 paths): Use Switch node instead of nested IF nodes. Keep the workflow visually clean.
- Large data volumes: Add SplitInBatches node with batch size of 10-50. Include rate limiting delays.
- Multiple triggers: Create separate workflows per trigger type. Use sub-workflows for shared logic.
- User asks for a workflow that's impossible: Explain the limitation and suggest the closest feasible alternative.
- Sensitive data: Never hardcode API keys, tokens, or passwords in the JSON. Always use credential placeholders.
- n8n Cloud vs self-hosted: Note if any nodes require self-hosted features (e.g., custom code execution, local file access).