Skip to main content

N8N Integration

N8N is a powerful workflow automation platform that enables you to connect HITL.sh with hundreds of other services and applications. This integration allows you to create sophisticated automated workflows that include human decision-making at critical points.

What is N8N?

N8N is an open-source workflow automation tool that provides:

N8N Features

  • Visual Workflow Builder: Drag-and-drop interface for creating automation workflows
  • 700+ Integrations: Connect with popular services and APIs
  • Custom Nodes: Build your own integration nodes
  • Self-Hosted: Deploy on your own infrastructure for full control
  • Webhook Support: Trigger workflows via HTTP requests

Why Integrate HITL.sh with N8N?

Automated Workflows

Trigger HITL.sh requests automatically based on events from other systems.

Human Decision Points

Insert human oversight at critical junctures in automated processes.

Multi-Service Integration

Connect HITL.sh with your entire tech stack through a single platform.

Visual Process Design

Design complex workflows visually without writing code.

Integration Overview

Workflow Components

A typical N8N + HITL.sh workflow includes:
1

Trigger Node

An event that starts the workflow (e.g., new email, form submission).
2

Processing Nodes

Transform data and prepare it for human review.
3

HITL.sh Node

Submit content for human review and wait for decision.
4

Decision Handling

Process the human decision and take appropriate action.
5

Action Nodes

Execute actions based on human decisions (e.g., send notifications, update databases).

Setting Up the Integration

1. Install N8N

1

Choose Installation Method

  • Docker: Quick setup with containerization
  • npm: Direct installation via Node.js
  • Self-hosted: Full control over deployment
2

Install N8N

# Using npm
npm install n8n -g

# Using Docker
docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  n8nio/n8n
3

Access N8N

Open your browser and navigate to http://localhost:5678

2. Configure HITL.sh Credentials

1

Get API Key

Generate an API key from your HITL.sh dashboard.
2

Add Credentials

In N8N, go to Settings → Credentials → Add Credential
3

Configure HITL.sh

3. Install HITL.sh Nodes

Custom Nodes

HITL.sh provides custom N8N nodes for seamless integration:
  • HITL.sh Request Node: Submit content for review
  • HITL.sh Response Node: Retrieve human decisions
  • HITL.sh Webhook Node: Receive real-time notifications

Building Your First Workflow

Content Moderation Workflow

Create a workflow that automatically moderates social media posts:
N8N workflow diagram showing content moderation with HITL.sh integration

Workflow Steps

1

Twitter Trigger

Monitor for new tweets containing specific keywords.
2

Content Analysis

Use AI service to analyze tweet content and flag potential issues.
3

HITL.sh Request

Submit flagged content for human review if AI confidence is low.
4

Wait for Decision

Pause workflow until human decision is received.
5

Process Decision

Take action based on human decision (approve, reject, or flag).

Node Configuration

Twitter Trigger Node:
{
  "resource": "tweet",
  "operation": "getAll",
  "searchText": "your_keywords_here",
  "includeRetweets": false
}
HITL.sh Request Node:
{
  "loop_id": "content_moderation",
  "content": "{{ $json.text }}",
  "content_type": "text",
  "priority": "normal",
  "metadata": {
    "user_id": "{{ $json.author_id }}",
    "tweet_id": "{{ $json.id }}",
    "source": "twitter"
  }
}

Customer Support Escalation Workflow

Automatically escalate support tickets that require human intervention:
1

Zendesk Trigger

Monitor for new support tickets with specific tags.
2

AI Classification

Use AI to classify ticket complexity and urgency.
3

HITL.sh Review

Route complex tickets to human agents for review.
4

Agent Assignment

Assign tickets to appropriate support agents based on human decision.
5

Notification System

Notify relevant stakeholders about escalated tickets.

Advanced Workflow Patterns

Conditional Routing

Route requests based on content characteristics:
// In a Code node
const content = $input.all()[0].json;
const ai_confidence = content.ai_analysis.confidence;

if (ai_confidence < 0.5) {
  // Low confidence - send to human review
  return {
    route_to_hitl: true,
    priority: "high"
  };
} else if (ai_confidence < 0.8) {
  // Medium confidence - send to human review
  return {
    route_to_hitl: true,
    priority: "normal"
  };
} else {
  // High confidence - auto-approve
  return {
    route_to_hitl: false,
    auto_approve: true
  };
}

Batch Processing

Process multiple requests together for efficiency:
// In a Code node
const requests = $input.all();
const batch_size = 10;
const batches = [];

for (let i = 0; i < requests.length; i += batch_size) {
  batches.push(requests.slice(i, i + batch_size));
}

return batches.map(batch => ({
  batch_requests: batch.map(req => ({
    content: req.json.content,
    content_type: req.json.content_type,
    priority: req.json.priority
  }))
}));

Error Handling

Implement robust error handling for your workflows:

Retry Logic

  • Configure automatic retries for failed API calls
  • Set exponential backoff for rate limiting
  • Handle temporary network issues gracefully

Fallback Actions

  • Define alternative actions when HITL.sh is unavailable
  • Implement manual review processes as backup
  • Log errors for monitoring and debugging

Webhook Integration

Real-Time Notifications

Receive instant updates when human decisions are made:
1

Configure Webhook

Set up webhook endpoint in HITL.sh pointing to your N8N instance.
2

Webhook Trigger Node

Create a webhook trigger node in N8N to receive notifications.
3

Process Notifications

Handle webhook payloads and trigger appropriate workflow actions.

Webhook Payload Example

{
  "event": "request.completed",
  "timestamp": "2024-01-15T11:45:00Z",
  "data": {
    "request_id": "req_abc123",
    "loop_id": "content_moderation",
    "decision": "approved",
    "reviewer_id": "reviewer_xyz789",
    "reasoning": "Content meets all guidelines",
    "confidence": 0.95
  }
}

Best Practices

Workflow Design

Modular Design

  • Break complex workflows into smaller, reusable components
  • Use sub-workflows for common operations
  • Maintain clear separation of concerns

Error Handling

  • Implement comprehensive error handling
  • Add logging and monitoring nodes
  • Create fallback paths for critical operations

Performance Optimization

  • Use batch processing when possible
  • Implement appropriate delays and rate limiting
  • Monitor workflow execution times

Documentation

  • Document workflow purpose and logic
  • Add comments to complex nodes
  • Maintain workflow version history

Security Considerations

  • Store API keys securely in N8N credentials
  • Rotate keys regularly
  • Use environment variables for sensitive data
  • Verify webhook signatures
  • Use HTTPS endpoints
  • Implement rate limiting on webhook triggers
  • Minimize data exposure in workflow logs
  • Implement data retention policies
  • Ensure compliance with privacy regulations

Monitoring and Analytics

Workflow Performance

Track the performance of your N8N workflows:

Execution Metrics

  • Success/failure rates
  • Execution times
  • Resource usage
  • Error frequency

Business Metrics

  • Requests processed per day
  • Human review response times
  • Decision accuracy rates
  • Workflow efficiency improvements

Alerting and Notifications

Set up alerts for workflow issues:
1

Error Monitoring

Monitor for workflow failures and errors.
2

Performance Alerts

Alert when workflows exceed expected execution times.
3

Business Alerts

Notify stakeholders about important business events.

Troubleshooting

Common Issues

  • Implement exponential backoff
  • Use batch processing to reduce API calls
  • Monitor API usage and adjust accordingly
  • Verify webhook endpoint accessibility
  • Check webhook signature verification
  • Monitor webhook delivery logs
  • Adjust timeout settings for long-running operations
  • Implement progress tracking for human review processes
  • Use appropriate delay nodes for waiting periods

Debugging Tips

Logging

  • Add logging nodes throughout your workflow
  • Use console.log in Code nodes for debugging
  • Monitor N8N execution logs

Testing

  • Test workflows with sample data
  • Use N8N’s test mode for validation
  • Create separate test workflows for development

Next Steps

Ready to build your first N8N + HITL.sh workflow?

Explore Other Integrations

Learn about Zapier integration for simpler automation.

Set Up Webhooks

Configure webhooks for real-time notifications.

API Reference

Detailed API documentation for custom integrations.

Community Support

Join the HITL.sh community for help and inspiration.
⌘I