Introduction & Overview
What is n8n?
n8n (pronounced "n-eight-n") is an open-source workflow automation platform that connects apps, services, databases, and AI models to work together automatically.
Why Choose n8n?
Advantages:
- ✅ Completely free to self-host
- ✅ Unlimited executions (no per-task pricing)
- ✅ Full data control and privacy
- ✅ Highly flexible with custom code and logic
- ✅ Excellent for complex integrations (ERP systems, APIs)
- ✅ Built-in support for AI agents and agentic workflows
- ✅ Active community and templates
Comparison: n8n vs Zapier
| Feature | n8n | Zapier |
|---|---|---|
| Cost | Free (self-hosted) | Paid tiers, expensive at scale |
| Complexity | Medium learning curve | Easy for simple tasks |
| Flexibility | High - custom code, complex logic | Limited to available integrations |
| Data Control | Full control (self-hosted) | Cloud-based only |
| Best For | Technical users, custom integrations, AI workflows | Non-technical users, quick simple automations |
| ERP Integration | Excellent (Oracle Cloud, SAP, etc.) | Basic support |
Common Use Cases
- Lead capture and notification systems
- ERP automation (Oracle Cloud, SAP)
- AI agent workflows
- Database synchronization
- Email marketing automation
- Customer service workflows
- Data processing pipelines
- API integration and orchestration
Core Concepts
1. Nodes - The Building Blocks
Nodes are individual steps in your workflow. There are three main types:
A. Trigger Nodes (Start the workflow)
- Webhook: Receive HTTP requests from external sources
- Schedule/Cron: Run workflows at specific times
- Email: Trigger when emails arrive
- Form: Trigger when forms are submitted
- Database: Trigger on database changes
B. Action Nodes (Perform tasks)
- HTTP Request: Call external APIs
- Send Email: Gmail, SMTP, SendGrid
- Database: Insert, update, query (MySQL, PostgreSQL, MongoDB)
- File Operations: Read, write, move files
- Transform Data: Format, filter, aggregate
C. Logic Nodes (Control flow)
- IF: Branch based on conditions
- Switch: Multiple conditional branches
- Merge: Combine data from multiple sources
- Function: Write custom JavaScript code
- Loop: Iterate over items
- Wait: Pause execution
2. Workflows - Your Automation Process
A workflow is a visual chain of connected nodes:
Trigger → Process Data → Decision Logic → Action → Notification
Example Flow:
Webhook (form data) → IF (validate email) → HTTP Request (Oracle API)
→ Function (transform) → Database (store) → Email (notify team)
3. Data Flow - Understanding JSON
All data in n8n flows as JSON (JavaScript Object Notation) - simple key-value pairs.
Example JSON:
{
"name": "Chandra Sekhar",
"email": "sekhar@example.com",
"message": "Interested in Oracle ERP automation",
"timestamp": "2026-04-03T10:30:00Z"
}
4. Expressions - Dynamic Data Access
Use expressions to pull data from previous steps:
| Expression | Description | Example |
|---|---|---|
{{$json["field"]}} |
Access field from current item | {{$json["email"]}} |
{{$json.field}} |
Dot notation (same as above) | {{$json.email}} |
{{$now}} |
Current timestamp | Auto-generated timestamp |
{{$today}} |
Today's date | Date calculations |
{{$node["NodeName"].json}} |
Access specific node output | Reference any node |
{{$items}} |
All items in current execution | Batch processing |
Common Expression Patterns:
// Get email from webhook
{{$json["email"]}}
// Combine first and last name
{{$json["firstName"]}} {{$json["lastName"]}}
// Conditional text
{{$json["status"] === "active" ? "Active User" : "Inactive"}}
// Current timestamp
{{$now.format("YYYY-MM-DD HH:mm:ss")}}
5. Credentials - Secure Authentication
Store API keys, passwords, and tokens securely:
- OAuth connections (Gmail, Google Sheets, Slack)
- API Key authentication
- Basic Auth (username/password)
- Header Auth
- Custom credentials
Best Practice: Never hardcode credentials in workflows. Always use the credential system.
6. Executions - Running Workflows
Manual Execution:
- Click "Execute Workflow" to test
- View step-by-step data flow
- Debug errors in real-time
Automatic Execution:
- Toggle workflow to "Active"
- Triggered by events (webhooks, schedules, etc.)
- View execution history and logs
Getting Started
Option 1: n8n Cloud (Easiest - Recommended for Beginners)
# Visit https://n8n.cloud
# Sign up for free account
# Start building immediately
Pros: No setup, automatic updates, managed hosting
Cons: Data stored on n8n servers, limited free tier
Option 2: Quick Local Test
# Requires Node.js installed
npx n8n
# Open browser to http://localhost:5678
Pros: Instant local testing, full features
Cons: Not persistent, data lost on restart
Option 3: Docker (Recommended for Self-Hosting)
# Using Docker
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
# Or using Docker Compose
version: "3.7"
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- "5678:5678"
volumes:
- ~/.n8n:/home/node/.n8n
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=your_password
Pros: Full control, persistent data, production-ready
Cons: Requires Docker knowledge, manual updates
Option 4: Self-Hosted (Production)
# Install globally
npm install n8n -g
# Run as service
n8n start
# Or with PM2 for production
pm2 start n8n
System Requirements
- Node.js: v18+ recommended
- RAM: Minimum 2GB (4GB+ for production)
- Storage: 10GB+ for workflows and logs
- Network: Internet access for external integrations
Building Your First Workflow
Project: Lead Capture Alert System
Goal: When someone submits a form, automatically send an email notification to your team.
What You'll Learn:
- Setting up webhooks
- Data validation with IF nodes
- Sending emails with dynamic content
- Testing and deploying workflows
Step-by-Step Implementation
Step 1: Create New Workflow
- Click + New Workflow
- Name it: "Lead Capture Alert System"
- Click Save
Step 2: Add Webhook Trigger
- Click + on canvas
- Search for "Webhook"
- Select Webhook node
- Configure:
- HTTP Method: POST
- Path:
lead-capture - Response Mode: Immediately
- Click Listen for Test Event
- Copy the webhook URL (save for later)
Your webhook URL will look like:
https://your-instance.n8n.cloud/webhook/lead-capture
Step 3: Add Data Validation (IF Node)
- Connect from Webhook node
- Add IF node
- Configure condition:
- Value 1:
{{$json["email"]}} - Operation: Is Not Empty
- Value 2: (leave empty)
- Value 1:
Why validate? Prevents processing incomplete submissions and reduces errors.
Step 4: Configure Email Node
- Connect from True output of IF node
- Add Gmail (or SMTP) node
- Set up credentials:
- Click Create New Credential
- Follow OAuth flow for Gmail
- Grant permissions
- Configure email:
To: your-team@company.com
Subject: 🚨 New Lead Received!
Email Type: HTML
Body:
<html>
<body style="font-family: Arial, sans-serif;">
<h2 style="color: #2c3e50;">New Lead Alert</h2>
<div style="background: #ecf0f1; padding: 20px; border-radius: 8px;">
<p><strong>Name:</strong> {{$json["name"]}}</p>
<p><strong>Email:</strong> {{$json["email"]}}</p>
<p><strong>Phone:</strong> {{$json["phone"]}}</p>
<p><strong>Message:</strong></p>
<p style="background: white; padding: 10px; border-radius: 4px;">
{{$json["message"]}}
</p>
<p style="color: #7f8c8d; font-size: 12px;">
<strong>Received:</strong> {{$now.format("MMMM DD, YYYY at HH:mm:ss")}}
</p>
</div>
</body>
</html>
Step 5: Add Error Notification (Optional but Recommended)
- Connect from False output of IF node
- Add No Operation node or Email node to notify about invalid submissions
- Configure as needed
Step 6: Test the Workflow
Using cURL:
curl -X POST https://your-instance.n8n.cloud/webhook/lead-capture \
-H "Content-Type: application/json" \
-d '{
"name": "Chandra Sekhar",
"email": "sekhar@example.com",
"phone": "+91-9876543210",
"message": "Interested in Oracle ERP automation services"
}'
Using Postman:
- Method: POST
- URL: Your webhook URL
- Body → raw → JSON
- Paste the JSON data above
- Click Send
Check Results:
- View execution in n8n (green = success)
- Check your email inbox
- Verify data flow through each node
Step 7: Deploy to Production
- Click Active toggle at top
- Workflow now runs automatically
- Integrate webhook URL into:
- Website forms (HTML/JavaScript)
- Typeform webhook settings
- Google Forms (via App Script)
- Any form builder supporting webhooks
Testing Checklist
- [ ] Webhook receives data correctly
- [ ] IF condition validates email properly
- [ ] Email sends with correct formatting
- [ ] Dynamic fields populate correctly
- [ ] Error handling works (test invalid data)
- [ ] Workflow activates successfully
Advanced Topics
Oracle Cloud ERP Integration
Scenario: Automate order processing in Oracle Cloud ERP
Workflow Design:
Webhook (new order)
→ Function (prepare data)
→ HTTP Request (Oracle API - create order)
→ IF (check success)
→ True: Database (log success) → Slack (notify team)
→ False: Email (alert admin) → Database (log error)
Sample Oracle API Call (HTTP Request Node)
// URL
https://your-oracle-instance.oraclecloud.com/fscmRestApi/resources/version/salesOrders
// Method: POST
// Headers
{
"Content-Type": "application/json",
"Authorization": "Bearer {{$credentials.oracleToken}}"
}
// Body
{
"OrderNumber": "{{$json["orderNumber"]}}",
"OrderDate": "{{$now.format('YYYY-MM-DD')}}",
"CustomerId": "{{$json["customerId"]}}",
"OrderLines": [
{
"ItemNumber": "{{$json["itemCode"]}}",
"Quantity": {{$json["quantity"]}},
"UnitPrice": {{$json["price"]}}
}
]
}
Function Node for Data Transformation
// Transform incoming webhook data for Oracle format
const items = $input.all();
const transformedData = [];
for (const item of items) {
transformedData.push({
OrderNumber: `ORD-${Date.now()}`,
OrderDate: new Date().toISOString(),
CustomerId: item.json.customer_id,
CustomerName: item.json.customer_name,
OrderLines: item.json.items.map(product => ({
ItemNumber: product.sku,
Description: product.name,
Quantity: parseInt(product.quantity),
UnitPrice: parseFloat(product.price),
LineTotal: parseInt(product.quantity) * parseFloat(product.price)
})),
OrderTotal: item.json.items.reduce((sum, product) =>
sum + (parseInt(product.quantity) * parseFloat(product.price)), 0
)
});
}
return transformedData;
AI Integration Examples
1. AI-Powered Lead Qualification
Webhook (lead data)
→ OpenAI (analyze message, extract intent)
→ IF (high-value lead?)
→ True: Send to sales CRM + notify manager
→ False: Send to marketing automation
2. Invoice Processing with AI
Email Trigger (new invoice received)
→ Extract attachment
→ OpenAI Vision (extract invoice data)
→ Function (structure data)
→ Oracle ERP (create invoice)
→ Database (log transaction)
Error Handling Patterns
Pattern 1: Retry Logic
// In Function node
const maxRetries = 3;
let attempt = 0;
let success = false;
while (attempt < maxRetries && !success) {
try {
// Your logic here
success = true;
} catch (error) {
attempt++;
if (attempt >= maxRetries) {
throw new Error(`Failed after ${maxRetries} attempts: ${error.message}`);
}
}
}
Pattern 2: Error Notification Workflow
Main Workflow (Error Trigger)
→ Function (format error details)
→ Email (notify admin)
→ Slack (post to #alerts channel)
→ Database (log error for analysis)
Working with Databases
PostgreSQL Integration Example
// Insert Node
INSERT INTO leads (name, email, message, created_at)
VALUES (
'{{$json["name"]}}',
'{{$json["email"]}}',
'{{$json["message"]}}',
NOW()
)
RETURNING id;
// Query Node
SELECT * FROM orders
WHERE status = 'pending'
AND created_at > NOW() - INTERVAL '24 hours'
ORDER BY created_at DESC;
// Update Node
UPDATE customers
SET last_contacted = NOW(),
contact_count = contact_count + 1
WHERE email = '{{$json["email"]}}';
Scheduled Workflows
Daily Report Example:
Schedule (Every day at 9 AM)
→ Database Query (get yesterday's stats)
→ Function (calculate metrics)
→ Google Sheets (update dashboard)
→ Email (send summary to team)
Cron Expression Reference:
0 9 * * *- Daily at 9:00 AM0 */4 * * *- Every 4 hours0 9 * * 1-5- Weekdays at 9:00 AM0 0 1 * *- First day of month at midnight
Best Practices {#best-practices}
1. Workflow Organization
Naming Conventions:
- Workflows: Use descriptive names with category prefix
[Sales] Lead Capture to CRM[ERP] Daily Order Sync[AI] Invoice Processing
- Nodes: Rename nodes for clarity
- Default: "HTTP Request"
- Better: "Oracle API - Create Order"
Folder Structure:
├── Sales & Marketing
│ ├── Lead Capture Alert
│ ├── Email Campaign Sync
│ └── Webinar Registration
├── ERP Integration
│ ├── Oracle Order Processing
│ ├── Inventory Sync
│ └── Invoice Automation
└── Internal Tools
├── Daily Reports
└── Database Backups
2. Error Handling Strategy
Always Include:
- Validation nodes (IF/Switch) before critical operations
- Error workflow branches
- Logging for debugging
- Notification system for failures
Example Pattern:
Action Node → IF (success check)
→ True: Continue workflow
→ False: Error Handler → Log → Notify Admin
3. Data Security
Do's:
- ✅ Use credential management system
- ✅ Validate and sanitize user input
- ✅ Use HTTPS for webhooks in production
- ✅ Implement rate limiting for public webhooks
- ✅ Regularly backup workflow JSON files
- ✅ Use environment variables for configs
Don'ts:
- ❌ Never hardcode API keys or passwords
- ❌ Don't expose sensitive data in logs
- ❌ Avoid storing PII unnecessarily
- ❌ Don't share webhook URLs publicly
4. Performance Optimization
Tips:
- Keep workflows focused (single responsibility)
- Use batch processing for large datasets
- Implement pagination for API calls
- Add wait nodes to respect rate limits
- Archive old execution data regularly
Batch Processing Example:
// Process items in chunks of 100
const items = $input.all();
const chunkSize = 100;
const chunks = [];
for (let i = 0; i < items.length; i += chunkSize) {
chunks.push(items.slice(i, i + chunkSize));
}
return chunks;
5. Testing Workflow
Testing Checklist:
- [ ] Test with valid data
- [ ] Test with invalid/missing data
- [ ] Test edge cases (empty strings, nulls)
- [ ] Test error scenarios
- [ ] Load test with multiple concurrent requests
- [ ] Verify all branches execute correctly
6. Version Control
Backup Strategy:
# Export workflow JSON regularly
# Store in Git repository
# Document changes in commit messages
# Example folder structure:
workflows/
├── sales-lead-capture-v1.json
├── sales-lead-capture-v2.json
└── changelog.md
7. Documentation
Document Each Workflow:
- Purpose and use case
- Trigger conditions
- Required credentials
- Expected data format
- Known limitations
- Maintenance notes
Example Workflow Header:
/*
WORKFLOW: Lead Capture Alert System
PURPOSE: Automatically notify sales team of new leads
TRIGGER: Webhook POST to /lead-capture
REQUIRED CREDENTIALS: Gmail OAuth
DATA FORMAT: { name, email, phone, message }
LAST UPDATED: 2026-04-03
OWNER: Sales Team
*/
Quick Reference {#quick-reference}
Essential Expressions Cheat Sheet
// Access data
{{$json["fieldName"]}} // Get field from current item
{{$json.fieldName}} // Dot notation
{{$node["NodeName"].json}} // Get data from specific node
// Date/Time
{{$now}} // Current timestamp
{{$now.format("YYYY-MM-DD")}} // Formatted date
{{$today}} // Today's date
{{$now.plus({days: 7})}} // Date arithmetic
// String operations
{{$json["name"].toUpperCase()}} // Uppercase
{{$json["email"].toLowerCase()}} // Lowercase
{{$json["text"].trim()}} // Remove whitespace
{{$json["str"].substring(0,10)}} // Substring
// Numbers
{{parseInt($json["value"])}} // Convert to integer
{{parseFloat($json["price"])}} // Convert to float
{{Math.round($json["amount"])}} // Round number
// Conditionals
{{$json["status"] === "active" ? "Yes" : "No"}}
{{$json["count"] > 10 ? "High" : "Low"}}
// Arrays
{{$json["items"].length}} // Array length
{{$json["items"][0]}} // First item
{{$json["items"].join(", ")}} // Join array to string
Common Node Configurations
Webhook Node
Method: POST
Path: custom-endpoint
Authentication: None (or Header Auth)
Response Mode: Immediately
Response Data: First Entry JSON
HTTP Request Node
Method: POST/GET/PUT/DELETE
URL: https://api.example.com/endpoint
Authentication: Via credentials
Headers: Content-Type: application/json
Body: JSON (use expressions)
IF Node
Condition Type: Boolean
Value 1: {{$json["field"]}}
Operation: Equal/Not Equal/Contains/Is Empty
Value 2: comparison value
Function Node (JavaScript)
// Access input items
const items = $input.all();
// Process each item
const results = items.map(item => {
return {
json: {
// Your transformed data
processedField: item.json.originalField.toUpperCase()
}
};
});
// Return results
return results;
HTTP Status Codes Reference
| Code | Meaning | Action |
|---|---|---|
| 200 | Success | Data processed correctly |
| 201 | Created | Resource created successfully |
| 400 | Bad Request | Check request format/data |
| 401 | Unauthorized | Verify credentials |
| 403 | Forbidden | Check permissions |
| 404 | Not Found | Verify URL/endpoint |
| 429 | Rate Limited | Add wait time, reduce requests |
| 500 | Server Error | Contact API provider |
Troubleshooting Guide
Problem: Workflow doesn't trigger
Solutions:
- Check if workflow is Active
- Verify webhook URL is correct
- Check trigger node configuration
- Review execution logs
Problem: Data not passing between nodes
Solutions:
- Verify node connections
- Check expression syntax
- Review JSON structure in previous node
- Use
{{$json}}to see all available data
Problem: API call failing
Solutions:
- Verify credentials are correct
- Check API endpoint URL
- Review required headers
- Test API call in Postman first
- Check rate limits
Problem: Email not sending
Solutions:
- Verify email credentials (OAuth token)
- Check recipient email address
- Review email content for errors
- Test with plain text first
- Check spam folder
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl/Cmd + S |
Save workflow |
Ctrl/Cmd + Enter |
Execute workflow |
Ctrl/Cmd + A |
Select all nodes |
Delete/Backspace |
Delete selected nodes |
Ctrl/Cmd + C |
Copy selected nodes |
Ctrl/Cmd + V |
Paste nodes |
Ctrl/Cmd + Z |
Undo |
Ctrl/Cmd + Shift + Z |
Redo |
Resources & Community
Official Resources:
- Documentation: https://docs.n8n.io
- Community Forum: https://community.n8n.io
- Templates: https://n8n.io/workflows
- GitHub: https://github.com/n8n-io/n8n
Learning Resources:
- YouTube: n8n official channel
- Discord: Active community support
- Blog: https://blog.n8n.io
Integration Catalogs:
- 400+ pre-built integrations
- Custom HTTP requests for any API
- Database connectors (MySQL, PostgreSQL, MongoDB)
- AI platforms (OpenAI, Anthropic, Google AI)
Practice Projects
Beginner Projects
- Email Digest: Schedule daily emails with RSS feed summaries
- Form to Spreadsheet: Save form submissions to Google Sheets
- Slack Bot: Respond to keywords in Slack channels
- Weather Alerts: Daily weather notifications via email
Intermediate Projects
- Lead Scoring System: Evaluate leads with AI and route to CRM
- Invoice Processor: Extract data from PDFs and update accounting system
- Social Media Monitor: Track mentions and send notifications
- Inventory Sync: Keep multiple systems in sync
Advanced Projects
- Oracle ERP Full Automation: Order-to-cash workflow
- AI Customer Service: Automated ticket triage and response
- Multi-System Data Pipeline: ETL across databases and APIs
- Agentic AI Workflow: Self-improving automation system
Conclusion
Key Takeaways
- n8n is a powerful, flexible automation platform
- Start simple with webhooks and email notifications
- Build complexity gradually with logic and integrations
- Focus on real business problems
- Leverage the community and templates
Next Steps
- Build the lead capture workflow (hands-on practice)
- Explore n8n template library for ideas
- Join the community forum for support
- Start automating one repetitive task per week
- Document and share your workflows
Career Impact
Skills you've gained:
- Workflow automation design
- API integration
- Data transformation
- Error handling
- Enterprise system integration (ERP)
- AI workflow implementation
These skills are highly valuable in 2026 for:
- Business Analysts
- ERP Consultants
- Operations Managers
- Data Engineers
- AI Engineers
- Automation Specialists
Remember: The best way to learn n8n is by building. Start with simple workflows and gradually increase complexity as you understand the patterns.
Happy automating! 🚀
