Skip to content

Durasi: 20 menit | Block: 2


🔗 Pattern A: n8n Feeds Data → Hermes Analyzes → Brief

Cocok untuk: Daily report, monitoring, automated insights

┌──────────────────────────────────────────────┐
│ PATTERN A: DATA FEED                         │
│                                              │
│ [n8n Cron/Schedule]                          │
│     → Pull data (Sheets/API/Database)        │
│     → Format as context                      │
│     → POST to Hermes API                     │
│         → Hermes analyze                     │
│         → Generate brief/report              │
│     → n8n receive output                     │
│     → Send via Email/WhatsApp/Slack          │
└──────────────────────────────────────────────┘

n8n Workflow

[Schedule: Daily 8 AM]
    → [Sheets: Read yesterday's data]
    → [Code Node: Format data as context string]
    → [HTTP Request: POST to Hermes]
    → [Set Node: Extract Hermes response]
    → [Email: Send daily brief]

HTTP Request ke Hermes

Node: HTTP Request
Method: POST
URL: http://[hermes-server]/api/chat
Headers:
  Authorization: Bearer [HERMES_API_KEY]
  Content-Type: application/json
Body:
{
  "message": "Ini data penjualan kemarin: \{{ $json.formatted_data }}. Buat morning brief dengan highlight dan rekomendasi.",
  "context": "morning-brief",
  "soul": "operations-assistant"
}

🔗 Pattern B: Webhook → Hermes Draft → Human Approve → n8n Execute

Cocok untuk: Auto-reply, content posting, action yang butuh quality gate

┌──────────────────────────────────────────────┐
│ PATTERN B: DRAFT-APPROVE-EXECUTE             │
│                                              │
│ [n8n Webhook: New Inquiry]                   │
│     → Format data                            │
│     → POST to Hermes: "Draft reply"          │
│         → Hermes generate draft              │
│     → Receive draft                          │
│     → Send to human for approval             │
│         → [Wait Node: Wait for approval]     │
│     → If approved:                           │
│         → n8n send reply via WhatsApp/Email  │
│     → If rejected:                           │
│         → Log + notify                       │
└──────────────────────────────────────────────┘

n8n Workflow

[Webhook: Customer Inquiry]
    → [HTTP Request: Hermes draft reply]
    → [Slack/Email: Send draft for approval]
    → [Wait Node: Wait for callback]
    → [If: Approved?]
        ├── YES → [HTTP Request: Send via WhatsApp API]
        └── NO  → [Sheets: Log rejection]

🔗 Pattern C: n8n Detects Event → Hermes Reacts

Cocok untuk: Anomaly detection, event-driven analysis, reactive automation

┌──────────────────────────────────────────────┐
│ PATTERN C: DETECT-REACT                      │
│                                              │
│ [n8n Monitor: Poll data/API]                 │
│     → [If: Anomaly detected?]               │
│         → YES: POST to Hermes                │
│             → Hermes analyze anomaly         │
│             → Generate insight + action      │
│         → Receive analysis                   │
│         → Alert team (Slack/WhatsApp)        │
│         → Optionally: n8n execute action     │
└──────────────────────────────────────────────┘

n8n Workflow

[Schedule: Every hour]
    → [Sheets/API: Check data]
    → [Code Node: Detect anomaly]
        → If anomaly:
            → [HTTP Request: Hermes analyze]
            → [Slack: Alert + recommendation]
            → [Sheets: Log event]

Anomaly Detection (Code Node)

javascript
const data = $input.all();
const latest = data[data.length - 1].json;
const avg = data.reduce((s, d) => s + d.json.value, 0) / data.length;

const isAnomaly = Math.abs(latest.value - avg) > (avg * 0.5); // 50% deviation

if (isAnomaly) {
  return [{
    json: {
      anomaly: true,
      type: latest.value > avg ? 'spike' : 'drop',
      current_value: latest.value,
      average: avg,
      deviation: ((latest.value - avg) / avg * 100).toFixed(1) + '%',
      context: `Anomaly detected: ${latest.value} vs avg ${avg.toFixed(0)}`
    }
  }];
}

return [{ json: { anomaly: false } }];

📊 Pattern Selection Guide

Use CasePatternKenapa
Daily sales reportA (Data Feed)Scheduled, predictable
Customer auto-replyB (Draft-Approve)Butuh quality gate
Price monitoringC (Detect-React)Event-driven, anomaly
Competitor weekly checkA (Data Feed)Scheduled research
Content postingB (Draft-Approve)Brand safety
Inventory alertC (Detect-React)Threshold-based
Weekly team briefA (Data Feed)Scheduled summary
Lead qualificationB (Draft-Approve)Important, needs review

🔧 Technical: n8n ↔ Hermes Communication

Option 1: HTTP API (Most Common)

n8n → HTTP Request → Hermes API endpoint
Hermes → Response in JSON → n8n process

Option 2: Webhook Callback

n8n → Trigger Hermes → Hermes process async
Hermes → Webhook callback → n8n Webhook node receives result

Option 3: Shared Storage

n8n → Write data to file/sheet
Hermes → Cron: Read data → Process → Write result
n8n → Read result

Pilih berdasarkan real-time needs. Option 1 = real-time. Option 3 = async.

Bootcamp AI Automation — akala.id