8
n8n 中文网amn8n.com

我的工作流程 2

中级

这是一个Miscellaneous, AI Summarization领域的自动化工作流,包含 14 个节点。主要使用 Code, EmailSend, ScheduleTrigger, ScrapegraphAi 等节点。 使用ScrapeGraphAI和邮件提醒自动化监管合规监控

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 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"
    }
  ],
  "nodes": [
    {
      "id": "084f3e30-edcd-41a6-a8d4-9b5c003bec82",
      "name": "由 Github 模型提供支持",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        240,
        368
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0ed22ae1-9405-4006-950f-0a56c59bf7da",
      "name": "ScrapeGraphAI",
      "type": "n8n-nodes-scrapegraphai.scrapegraphAi",
      "position": [
        944,
        624
      ],
      "parameters": {
        "userPrompt": "Extract regulatory changes and new rules from this government site. Use the following schema for response: { \"title\": \"Rule Title\", \"agency\": \"SEC\", \"publication_date\": \"2025-01-15\", \"effective_date\": \"2025-03-15\", \"summary\": \"Brief description of the rule\", \"impact_level\": \"High/Medium/Low\", \"affected_sectors\": [\"Financial Services\", \"Banking\"], \"document_url\": \"https://federalregister.gov/...\", \"rule_type\": \"Final Rule/Proposed Rule/Notice\", \"comment_deadline\": \"2025-02-15\" }",
        "websiteUrl": "https://www.federalregister.gov/documents/search?conditions%5Bagencies%5D%5B%5D=securities-and-exchange-commission&conditions%5Bpublication_date%5D%5Bgte%5D={{ $now.minus({ days: 1 }).toISODate() }}"
      },
      "typeVersion": 1
    },
    {
      "id": "f82dfb15-b15a-4436-8256-082f4169de47",
      "name": "法规解析器",
      "type": "n8n-nodes-base.code",
      "notes": "Parse and clean\nregulatory data\nfrom scraping",
      "position": [
        1680,
        368
      ],
      "parameters": {
        "jsCode": "// Get the input data from ScrapeGraphAI\nconst inputData = $input.all()[0].json;\n\n// Extract regulatory changes array from result\nconst regulations = inputData.result.regulatory_changes || inputData.result.rules || inputData.result.regulations || inputData.regulations || [];\n\nfunction parseRegulation(regulation) {\n  const {\n    title,\n    agency,\n    publication_date,\n    effective_date,\n    summary,\n    impact_level,\n    affected_sectors,\n    document_url,\n    rule_type,\n    comment_deadline\n  } = regulation;\n\n  // Clean and validate data\n  const cleanTitle = title?.trim() || 'Title not available';\n  const cleanAgency = agency?.trim() || 'Agency not specified';\n  const cleanSummary = summary?.trim() || 'Summary not available';\n  const cleanImpactLevel = impact_level || 'Medium';\n  const cleanRuleType = rule_type || 'Unknown';\n  const cleanUrl = document_url || '#';\n  \n  // Parse dates\n  const pubDate = publication_date ? new Date(publication_date).toLocaleDateString() : 'Not specified';\n  const effDate = effective_date ? new Date(effective_date).toLocaleDateString() : 'Not specified';\n  const commentDate = comment_deadline ? new Date(comment_deadline).toLocaleDateString() : 'N/A';\n  \n  // Handle sectors array\n  const sectors = Array.isArray(affected_sectors) ? affected_sectors : (affected_sectors ? [affected_sectors] : ['General']);\n  \n  return {\n    title: cleanTitle,\n    agency: cleanAgency,\n    publication_date: pubDate,\n    effective_date: effDate,\n    summary: cleanSummary,\n    impact_level: cleanImpactLevel,\n    affected_sectors: sectors,\n    document_url: cleanUrl,\n    rule_type: cleanRuleType,\n    comment_deadline: commentDate,\n    parsed_at: new Date().toISOString()\n  };\n}\n\n// Debug log\nconsole.log(`Found ${regulations.length} regulatory changes`);\n\n// Return each regulation as separate execution with parsed data\nreturn regulations.map(regulation => ({\n  json: parseRegulation(regulation)\n}));"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "0027ecda-5b32-4cfa-b0b4-dac6c967f548",
      "name": "影响评估器",
      "type": "n8n-nodes-base.code",
      "notes": "Assess business\nimpact and risk\nlevels",
      "position": [
        2448,
        480
      ],
      "parameters": {
        "jsCode": "// Get parsed regulation data\nconst regulation = $input.all()[0].json;\n\n// Define impact assessment criteria\nfunction assessImpact(regulation) {\n  const { title, summary, affected_sectors, rule_type, agency } = regulation;\n  \n  let impactScore = 0;\n  let riskFactors = [];\n  let opportunities = [];\n  let complianceActions = [];\n  \n  // Impact scoring based on rule type\n  switch (rule_type.toLowerCase()) {\n    case 'final rule':\n      impactScore += 3;\n      complianceActions.push('Immediate compliance review required');\n      break;\n    case 'proposed rule':\n      impactScore += 2;\n      complianceActions.push('Prepare comment response');\n      break;\n    case 'notice':\n      impactScore += 1;\n      complianceActions.push('Monitor for developments');\n      break;\n  }\n  \n  // Sector-specific impact assessment\n  const criticalSectors = ['financial services', 'banking', 'healthcare', 'energy', 'technology'];\n  const matchedCriticalSectors = affected_sectors.filter(sector => \n    criticalSectors.some(critical => sector.toLowerCase().includes(critical.toLowerCase()))\n  );\n  \n  if (matchedCriticalSectors.length > 0) {\n    impactScore += 2;\n    riskFactors.push(`Direct impact on critical sectors: ${matchedCriticalSectors.join(', ')}`);\n  }\n  \n  // Keyword-based impact assessment\n  const highImpactKeywords = ['compliance', 'penalty', 'fine', 'mandatory', 'prohibited', 'required'];\n  const mediumImpactKeywords = ['guidance', 'recommendation', 'best practice', 'voluntary'];\n  const opportunityKeywords = ['incentive', 'tax credit', 'grant', 'funding', 'streamlined'];\n  \n  const textToAnalyze = `${title} ${summary}`.toLowerCase();\n  \n  highImpactKeywords.forEach(keyword => {\n    if (textToAnalyze.includes(keyword)) {\n      impactScore += 1;\n      riskFactors.push(`Contains high-impact keyword: ${keyword}`);\n    }\n  });\n  \n  mediumImpactKeywords.forEach(keyword => {\n    if (textToAnalyze.includes(keyword)) {\n      impactScore += 0.5;\n    }\n  });\n  \n  opportunityKeywords.forEach(keyword => {\n    if (textToAnalyze.includes(keyword)) {\n      opportunities.push(`Potential opportunity: ${keyword}`);\n    }\n  });\n  \n  // Determine final impact level\n  let finalImpactLevel;\n  if (impactScore >= 5) {\n    finalImpactLevel = 'Critical';\n    complianceActions.push('Executive review required within 24 hours');\n  } else if (impactScore >= 3) {\n    finalImpactLevel = 'High';\n    complianceActions.push('Legal and compliance team review required');\n  } else if (impactScore >= 1.5) {\n    finalImpactLevel = 'Medium';\n    complianceActions.push('Department head review recommended');\n  } else {\n    finalImpactLevel = 'Low';\n    complianceActions.push('Standard monitoring sufficient');\n  }\n  \n  return {\n    ...regulation,\n    impact_assessment: {\n      impact_score: impactScore,\n      final_impact_level: finalImpactLevel,\n      risk_factors: riskFactors,\n      opportunities: opportunities,\n      compliance_actions: complianceActions,\n      assessment_date: new Date().toISOString()\n    }\n  };\n}\n\n// Return assessed regulation\nreturn [{ json: assessImpact(regulation) }];"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "72a0346a-6a67-4a07-87f7-ceeb1178e939",
      "name": "合规追踪器",
      "type": "n8n-nodes-base.code",
      "notes": "Create compliance\ntracking record\nand tasks",
      "position": [
        3200,
        432
      ],
      "parameters": {
        "jsCode": "// Get assessed regulation data\nconst regulation = $input.all()[0].json;\nconst { impact_assessment, title, agency, effective_date, comment_deadline } = regulation;\n\n// Create compliance tracking record\nfunction createComplianceTracker(regulation) {\n  const compliance = {\n    regulation_id: `REG_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,\n    title: regulation.title,\n    agency: regulation.agency,\n    status: 'New',\n    priority: regulation.impact_assessment.final_impact_level,\n    key_dates: {\n      publication_date: regulation.publication_date,\n      effective_date: regulation.effective_date,\n      comment_deadline: regulation.comment_deadline,\n      review_due_date: calculateReviewDate(regulation.impact_assessment.final_impact_level)\n    },\n    assigned_team: assignTeam(regulation.impact_assessment.final_impact_level),\n    compliance_tasks: generateComplianceTasks(regulation),\n    tracking_status: {\n      initial_review: 'Pending',\n      impact_analysis: 'Pending',\n      policy_update: 'Pending',\n      training_required: 'Pending',\n      implementation: 'Pending'\n    },\n    created_at: new Date().toISOString(),\n    last_updated: new Date().toISOString()\n  };\n  \n  return {\n    ...regulation,\n    compliance_tracking: compliance\n  };\n}\n\nfunction calculateReviewDate(impactLevel) {\n  const now = new Date();\n  switch (impactLevel) {\n    case 'Critical':\n      return new Date(now.getTime() + 24 * 60 * 60 * 1000).toISOString(); // 1 day\n    case 'High':\n      return new Date(now.getTime() + 3 * 24 * 60 * 60 * 1000).toISOString(); // 3 days\n    case 'Medium':\n      return new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000).toISOString(); // 1 week\n    default:\n      return new Date(now.getTime() + 14 * 24 * 60 * 60 * 1000).toISOString(); // 2 weeks\n  }\n}\n\nfunction assignTeam(impactLevel) {\n  switch (impactLevel) {\n    case 'Critical':\n      return ['Executive Team', 'Legal', 'Compliance', 'Operations'];\n    case 'High':\n      return ['Legal', 'Compliance', 'Department Heads'];\n    case 'Medium':\n      return ['Compliance', 'Relevant Department'];\n    default:\n      return ['Compliance'];\n  }\n}\n\nfunction generateComplianceTasks(regulation) {\n  const baseTasks = [\n    'Review regulation text',\n    'Assess current policy alignment',\n    'Identify compliance gaps'\n  ];\n  \n  const { final_impact_level, compliance_actions } = regulation.impact_assessment;\n  \n  if (final_impact_level === 'Critical' || final_impact_level === 'High') {\n    baseTasks.push(\n      'Conduct legal review',\n      'Update internal policies',\n      'Plan staff training',\n      'Create implementation timeline'\n    );\n  }\n  \n  if (regulation.comment_deadline !== 'N/A') {\n    baseTasks.push('Prepare regulatory comment response');\n  }\n  \n  return baseTasks.concat(compliance_actions);\n}\n\n// Return regulation with compliance tracking\nreturn [{ json: createComplianceTracker(regulation) }];"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "59ac11b9-2a10-4fed-ac03-a73e5d92ec3b",
      "name": "高管警报",
      "type": "n8n-nodes-base.code",
      "notes": "Format executive\nalert message",
      "position": [
        3968,
        432
      ],
      "parameters": {
        "jsCode": "// Get regulation with compliance tracking\nconst regulation = $input.all()[0].json;\nconst { impact_assessment, compliance_tracking } = regulation;\n\n// Format executive alert based on impact level\nfunction formatExecutiveAlert(regulation) {\n  const { title, agency, impact_assessment, compliance_tracking } = regulation;\n  const { final_impact_level, risk_factors, opportunities } = impact_assessment;\n  \n  let alertLevel = '⚠️';\n  let urgency = 'Standard';\n  \n  switch (final_impact_level) {\n    case 'Critical':\n      alertLevel = '🚨';\n      urgency = 'URGENT';\n      break;\n    case 'High':\n      alertLevel = '⚠️';\n      urgency = 'High Priority';\n      break;\n    case 'Medium':\n      alertLevel = '📋';\n      urgency = 'Medium Priority';\n      break;\n    case 'Low':\n      alertLevel = 'ℹ️';\n      urgency = 'Low Priority';\n      break;\n  }\n  \n  let message = `${alertLevel} **REGULATORY ALERT - ${urgency}**\\n\\n`;\n  message += `**Regulation:** ${title}\\n`;\n  message += `**Agency:** ${agency}\\n`;\n  message += `**Impact Level:** ${final_impact_level}\\n`;\n  message += `**Publication Date:** ${regulation.publication_date}\\n`;\n  message += `**Effective Date:** ${regulation.effective_date}\\n\\n`;\n  \n  message += `**📊 SUMMARY**\\n${regulation.summary}\\n\\n`;\n  \n  if (risk_factors.length > 0) {\n    message += `**⚠️ RISK FACTORS**\\n`;\n    risk_factors.forEach(risk => {\n      message += `• ${risk}\\n`;\n    });\n    message += `\\n`;\n  }\n  \n  if (opportunities.length > 0) {\n    message += `**💡 OPPORTUNITIES**\\n`;\n    opportunities.forEach(opp => {\n      message += `• ${opp}\\n`;\n    });\n    message += `\\n`;\n  }\n  \n  message += `**👥 ASSIGNED TEAMS**\\n${compliance_tracking.assigned_team.join(', ')}\\n\\n`;\n  \n  message += `**📅 KEY DATES**\\n`;\n  message += `• Review Due: ${new Date(compliance_tracking.key_dates.review_due_date).toLocaleDateString()}\\n`;\n  if (regulation.comment_deadline !== 'N/A') {\n    message += `• Comment Deadline: ${regulation.comment_deadline}\\n`;\n  }\n  message += `• Effective Date: ${regulation.effective_date}\\n\\n`;\n  \n  message += `**✅ IMMEDIATE ACTIONS REQUIRED**\\n`;\n  compliance_tracking.compliance_tasks.slice(0, 5).forEach(task => {\n    message += `• ${task}\\n`;\n  });\n  \n  message += `\\n**🔗 RESOURCES**\\n`;\n  message += `• [Full Regulation Document](${regulation.document_url})\\n`;\n  message += `• Compliance ID: ${compliance_tracking.regulation_id}\\n\\n`;\n  \n  message += `**📈 TRACKING STATUS**\\nAll compliance tasks have been logged and assigned. Progress will be monitored through the compliance dashboard.\\n\\n`;\n  \n  message += `━━━━━━━━━━━━━━━━━━━━━━\\n`;\n  message += `🕐 Alert Generated: ${new Date().toLocaleString()}`;\n  \n  return message;\n}\n\n// Return formatted alert\nreturn [{\n  json: {\n    alert_text: formatExecutiveAlert(regulation),\n    alert_level: regulation.impact_assessment.final_impact_level,\n    regulation_id: regulation.compliance_tracking.regulation_id,\n    title: regulation.title,\n    agency: regulation.agency,\n    effective_date: regulation.effective_date,\n    assigned_teams: regulation.compliance_tracking.assigned_team,\n    review_due_date: regulation.compliance_tracking.key_dates.review_due_date,\n    document_url: regulation.document_url\n  }\n}]);"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "ca7c5d3e-9fbc-4fd4-be75-a709463f989c",
      "name": "邮件警报",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        4688,
        528
      ],
      "webhookId": "0b4a0564-f0cf-4d92-9227-8172df56d509",
      "parameters": {
        "options": {
          "ccEmail": "regulatory-monitor@company.com"
        },
        "subject": "🚨 Regulatory Alert: {{ $json.alert_level }} Impact - {{ $json.title }}"
      },
      "typeVersion": 2
    },
    {
      "id": "042db0d2-3542-4818-8540-1abacdcff0a3",
      "name": "便签 - 触发器",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 1:定时触发器 ⏱️"
      },
      "typeVersion": 1
    },
    {
      "id": "1db2ba2f-034c-4c81-89e0-ff20e1f0f090",
      "name": "便签 - 爬虫",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 802,
        "content": "# 步骤 2:ScrapeGraphAI - 政府网站 🤖"
      },
      "typeVersion": 1
    },
    {
      "id": "698e22f1-b735-4b59-8e57-398e3c7b05d9",
      "name": "便签 - 解析器",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 3:法规解析器 🧱"
      },
      "typeVersion": 1
    },
    {
      "id": "f934cb28-2de3-4bdd-b4b1-7188c102221a",
      "name": "便签 - 评估器",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 706,
        "content": "# 步骤 4:影响评估器 📊"
      },
      "typeVersion": 1
    },
    {
      "id": "47c2b00a-a24b-4bba-af23-4b25ed6bdf9f",
      "name": "便签 - 追踪器",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2992,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 626,
        "content": "# 步骤 5:合规追踪器 📋"
      },
      "typeVersion": 1
    },
    {
      "id": "c5d0dcbe-8f8d-49d5-aa70-379ca0dd8d72",
      "name": "便签 - 警报",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3744,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 658,
        "content": "# 步骤 6:高管警报 📧"
      },
      "typeVersion": 1
    },
    {
      "id": "d5731eb6-3f2c-4e1c-9927-f2c95a522b51",
      "name": "便签 - 邮箱",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4448,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 690,
        "content": "# 步骤 7:邮件警报 📬"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ddbb349b-d97b-4e8e-b644-332bd48d815c",
  "connections": {
    "ScrapeGraphAI": {
      "main": [
        [
          {
            "node": "Regulation Parser",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Executive Alert": {
      "main": [
        [
          {
            "node": "Email Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Impact Assessor": {
      "main": [
        [
          {
            "node": "Compliance Tracker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "ScrapeGraphAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Regulation Parser": {
      "main": [
        [
          {
            "node": "Impact Assessor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compliance Tracker": {
      "main": [
        [
          {
            "node": "Executive Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 杂项, AI 摘要总结

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流