8
n8n 中文网amn8n.com

我的工作流程2

中级

这是一个DevOps, AI Summarization领域的自动化工作流,包含 13 个节点。主要使用 If, Code, Telegram, ScheduleTrigger, ScrapegraphAi 等节点。 基于ScrapeGraphAI和Telegram的智能物联网设备健康监控

前置要求
  • Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "VhEwspDqzu7ssFVE",
  "meta": {
    "instanceId": "f4b0efaa33080e7774e0d9285c40c7abcd2c6f7cf1a8b901fa7106170dd4cda3",
    "templateCredsSetupCompleted": true
  },
  "name": "我的工作流程 2",
  "tags": [
    {
      "id": "DxXGubfBzRKh6L8T",
      "name": "Revenue Optimization",
      "createdAt": "2025-07-25T16:24:30.370Z",
      "updatedAt": "2025-07-25T16:24:30.370Z"
    },
    {
      "id": "IxkcJ2IpYIxivoHV",
      "name": "Content Strategy",
      "createdAt": "2025-07-25T12:57:37.677Z",
      "updatedAt": "2025-07-25T12:57:37.677Z"
    },
    {
      "id": "PAKIJ2Mm9EvRcR3u",
      "name": "Trend Monitoring",
      "createdAt": "2025-07-25T12:57:37.670Z",
      "updatedAt": "2025-07-25T12:57:37.670Z"
    },
    {
      "id": "YtfXmaZk44MYedPO",
      "name": "Dynamic Pricing",
      "createdAt": "2025-07-25T16:24:30.369Z",
      "updatedAt": "2025-07-25T16:24:30.369Z"
    },
    {
      "id": "wJ30mjhtrposO8Qt",
      "name": "Simple RAG",
      "createdAt": "2025-07-28T12:55:14.424Z",
      "updatedAt": "2025-07-28T12:55:14.424Z"
    }
  ],
  "nodes": [
    {
      "id": "ed780f44-e2dc-4cf2-876d-8e64b9b5349e",
      "name": "📋 Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        32
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 400,
        "content": "# Simple IoT Monitor 🏭\n\n**What it does:**\n- Monitors IoT dashboard every 30 minutes\n- Extracts device data with AI\n- Sends alerts when issues found\n- Logs all activity\n\n**Setup:**\n1. Change dashboard URL\n2. Set Telegram chat ID\n3. Configure ScrapeGraphAI\n4. Run!\n\n**Features:**\n✅ Auto monitoring\n✅ Smart alerts\n✅ Device health check\n✅ Battery monitoring\n✅ Temperature alerts"
      },
      "typeVersion": 1
    },
    {
      "id": "bf257863-5d96-412b-8f2e-2b2040aeadd0",
      "name": "⏰ Timer Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        32
      ],
      "parameters": {
        "color": 5,
        "width": 250,
        "height": 652,
        "content": "# Step 1: Timer ⏰\n\n**Runs every 30 minutes**\n\nChange cron expression:\n- Every 15 min: */15 * * * *\n- Every hour: 0 * * * *\n- Every 5 min: */5 * * * *\n\nTimezone aware and reliable."
      },
      "typeVersion": 1
    },
    {
      "id": "46b8fdca-2fc6-4dbe-9dbb-af6281ccfb7e",
      "name": "⏰ Timer",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        96,
        464
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "*/30 * * * *"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "c0662ec5-597b-437b-b022-ce20cbe47adc",
      "name": "🤖 Scraper Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        48
      ],
      "parameters": {
        "color": 6,
        "width": 250,
        "height": 636,
        "content": "# Step 2: Get Data 🤖\n\n**AI extracts device info**\n\nReads any IoT dashboard:\n- Device status\n- Battery levels\n- Temperature\n- Connectivity\n\nNo API needed!"
      },
      "typeVersion": 1
    },
    {
      "id": "ade35d85-0de9-4b07-8e50-c335ba0d140f",
      "name": "🤖 Get Data",
      "type": "n8n-nodes-scrapegraphai.scrapegraphAi",
      "position": [
        352,
        464
      ],
      "parameters": {
        "userPrompt": "Extract IoT device data as JSON:\n\n{\n  \"devices\": [\n    {\n      \"id\": \"device_id\",\n      \"name\": \"device_name\", \n      \"status\": \"online/offline/error\",\n      \"battery\": 85,\n      \"temperature\": 25\n    }\n  ],\n  \"summary\": {\n    \"total\": 10,\n    \"online\": 8,\n    \"offline\": 2\n  }\n}\n\nFocus on device health and status.",
        "websiteUrl": "https://your-iot-dashboard.com/devices"
      },
      "typeVersion": 1
    },
    {
      "id": "fa8f9347-c465-4633-bcb7-c0784ff61e45",
      "name": "📊 Analyzer Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        48
      ],
      "parameters": {
        "color": 2,
        "width": 250,
        "height": 636,
        "content": "# Step 3: Check Health 📊\n\n**Analyzes device data**\n\nCalculates:\n- Health score (0-100%)\n- Problem devices\n- Battery alerts\n- Temperature warnings\n\nSmart recommendations."
      },
      "typeVersion": 1
    },
    {
      "id": "9642ecf6-b826-4175-b0f4-ac6eaff243c2",
      "name": "📊 Analyze",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        480
      ],
      "parameters": {
        "jsCode": "const data = $input.all()[0].json;\n\n// Simple analysis\nlet result = {\n  timestamp: new Date().toISOString(),\n  total_devices: data.summary?.total || 0,\n  online_devices: data.summary?.online || 0,\n  offline_devices: data.summary?.offline || 0,\n  health_score: 100,\n  problems: [],\n  alerts: []\n};\n\n// Calculate health\nif (result.total_devices > 0) {\n  const onlineRate = result.online_devices / result.total_devices;\n  result.health_score = Math.round(onlineRate * 100);\n}\n\n// Check for problems\nif (data.devices) {\n  data.devices.forEach(device => {\n    if (device.status === 'offline') {\n      result.problems.push(`${device.name} is offline`);\n    }\n    if (device.battery && device.battery < 20) {\n      result.problems.push(`${device.name} low battery: ${device.battery}%`);\n    }\n    if (device.temperature && device.temperature > 70) {\n      result.problems.push(`${device.name} overheating: ${device.temperature}°C`);\n    }\n  });\n}\n\n// Generate alerts\nif (result.health_score < 80) {\n  result.alerts.push('System health below 80%');\n}\nif (result.offline_devices > 0) {\n  result.alerts.push(`${result.offline_devices} devices offline`);\n}\n\nconsole.log(`Health: ${result.health_score}%, Problems: ${result.problems.length}`);\n\nreturn [{ json: result }];"
      },
      "typeVersion": 2
    },
    {
      "id": "29ac2b96-7a55-406f-bf53-1f138870c991",
      "name": "🚨 Alert Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        48
      ],
      "parameters": {
        "color": 4,
        "width": 250,
        "height": 636,
        "content": "# Step 4: Send Alert 🚨\n\n**Smart alerting**\n\nSends alert if:\n- Health score < 80%\n- Devices offline\n- Battery low\n- Temperature high\n\nPrevents spam."
      },
      "typeVersion": 1
    },
    {
      "id": "2e7280f1-cd14-41ec-b8ff-284a9f200ded",
      "name": "🚨 Need Alert?",
      "type": "n8n-nodes-base.if",
      "position": [
        880,
        432
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "health-check",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $json.health_score }}",
              "rightValue": "80"
            },
            {
              "id": "problems-check",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.problems.length }}",
              "rightValue": "0"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "7e34bdb4-5b9c-4707-8eeb-68c7e55c10f0",
      "name": "📱 Telegram Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        -192
      ],
      "parameters": {
        "color": 8,
        "width": 250,
        "height": 508,
        "content": "# Step 5: Telegram 📱\n\n**Send notification**\n\nReplace YOUR_CHAT_ID\nwith your actual chat ID.\n\nGet it from @userinfobot\n\nFormats message nicely\nwith emojis and details."
      },
      "typeVersion": 1
    },
    {
      "id": "ddc4e020-d964-46f1-b70b-503a48da9530",
      "name": "📱 Send Alert",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1120,
        176
      ],
      "webhookId": "9707d5fd-75f3-4ba8-9b99-12ba28596e10",
      "parameters": {
        "operation": "post"
      },
      "typeVersion": 1.1
    },
    {
      "id": "9930efb4-ff89-4cd5-9389-6ddbc298c69c",
      "name": "📝 Logger Info",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        320
      ],
      "parameters": {
        "width": 250,
        "height": 492,
        "content": "# Step 6: Log Data 📝\n\n**Keep records**\n\nLogs every check:\n- Health scores\n- Device counts\n- Problems found\n- Timestamps\n\nFor tracking trends."
      },
      "typeVersion": 1
    },
    {
      "id": "e973db8d-88b4-4013-94c1-541b8129d198",
      "name": "📝 Log Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1104,
        672
      ],
      "parameters": {
        "jsCode": "const data = $input.all()[0].json;\n\n// Simple logging\nconst log = {\n  timestamp: data.timestamp,\n  health_score: data.health_score,\n  total_devices: data.total_devices,\n  online_devices: data.online_devices,\n  offline_devices: data.offline_devices,\n  problems_count: data.problems.length,\n  alert_sent: data.alerts.length > 0\n};\n\nconsole.log(`IoT Check: ${log.health_score}% health, ${log.problems_count} problems`);\n\n// Here you could save to database or file\n// Example: await database.logs.insert(log);\n\nreturn [{ json: log }];"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f101b0f6-2734-4074-ac91-959ea9b0d248",
  "connections": {
    "⏰ Timer": {
      "main": [
        [
          {
            "node": "🤖 Get Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📊 Analyze": {
      "main": [
        [
          {
            "node": "🚨 Need Alert?",
            "type": "main",
            "index": 0
          },
          {
            "node": "📝 Log Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🤖 Get Data": {
      "main": [
        [
          {
            "node": "📊 Analyze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🚨 Need Alert?": {
      "main": [
        [
          {
            "node": "📱 Send Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 开发运维, AI 摘要总结

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量13
分类2
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流