{
  "id": "VhEwspDqzu7ssFVE",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "My workflow 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": "d14c0190-4c72-43aa-aad1-fa97bf8c79d4",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -464,
        64
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 24
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7027c64b-a3d8-4e72-9cb4-c02a5a563aaf",
      "name": "ScrapeGraphAI Web Search",
      "type": "n8n-nodes-scrapegraphai.scrapegraphAi",
      "position": [
        -64,
        400
      ],
      "parameters": {
        "userPrompt": "Search for potential copyright infringement by extracting any content that matches our copyrighted material. Look for: exact text matches, paraphrased content, unauthorized use of brand names, stolen images or videos, and plagiarized articles. Return results in this schema: { \"url\": \"https://example.com/page\", \"title\": \"Page Title\", \"content_snippet\": \"Matching content found\", \"match_type\": \"exact_match|paraphrase|brand_usage|image_theft\", \"confidence_score\": \"high|medium|low\", \"domain\": \"example.com\", \"date_found\": \"2024-01-01\" }",
        "websiteUrl": "https://www.google.com/search?q=\"your+copyrighted+content+here\"+OR+\"brand+name\"+OR+\"unique+phrase\""
      },
      "typeVersion": 1
    },
    {
      "id": "e526d918-fa3d-40f2-882f-5e2f7d3e40a0",
      "name": "Content Comparer",
      "type": "n8n-nodes-base.code",
      "notes": "Analyzes potential\ninfringements and\ncalculates similarity",
      "position": [
        480,
        336
      ],
      "parameters": {
        "jsCode": "// Get the input data from ScrapeGraphAI\nconst inputData = $input.all()[0].json;\n\n// Extract potential infringements from result\nconst potentialInfringements = inputData.result.copyright_matches || inputData.result.matches || inputData.result.infringements || [];\n\n// Define your copyrighted content for comparison\nconst copyrightedContent = {\n  texts: [\n    \"Your unique copyrighted text here\",\n    \"Another protected phrase or paragraph\",\n    \"Brand slogan or tagline\"\n  ],\n  brandNames: [\"YourBrand\", \"CompanyName\", \"ProductName\"],\n  domains: [\"yourwebsite.com\", \"yourcompany.com\"]\n};\n\n// Function to calculate similarity score\nfunction calculateSimilarity(text1, text2) {\n  const words1 = text1.toLowerCase().split(/\\W+/);\n  const words2 = text2.toLowerCase().split(/\\W+/);\n  const intersection = words1.filter(word => words2.includes(word));\n  return intersection.length / Math.max(words1.length, words2.length);\n}\n\n// Function to analyze potential infringement\nfunction analyzeInfringement(item) {\n  const analysis = {\n    url: item.url,\n    title: item.title,\n    content_snippet: item.content_snippet,\n    domain: item.domain,\n    date_found: new Date().toISOString().split('T')[0],\n    infringement_type: [],\n    similarity_scores: [],\n    risk_level: 'low',\n    requires_action: false\n  };\n\n  // Check for exact text matches\n  copyrightedContent.texts.forEach((protectedText, index) => {\n    const similarity = calculateSimilarity(protectedText, item.content_snippet || '');\n    analysis.similarity_scores.push({\n      text_index: index,\n      score: similarity\n    });\n    \n    if (similarity > 0.8) {\n      analysis.infringement_type.push('high_similarity_text');\n      analysis.risk_level = 'high';\n      analysis.requires_action = true;\n    } else if (similarity > 0.5) {\n      analysis.infringement_type.push('moderate_similarity_text');\n      analysis.risk_level = analysis.risk_level === 'low' ? 'medium' : analysis.risk_level;\n    }\n  });\n\n  // Check for brand name usage\n  const contentLower = (item.content_snippet || '').toLowerCase();\n  const titleLower = (item.title || '').toLowerCase();\n  \n  copyrightedContent.brandNames.forEach(brand => {\n    if (contentLower.includes(brand.toLowerCase()) || titleLower.includes(brand.toLowerCase())) {\n      analysis.infringement_type.push('unauthorized_brand_usage');\n      analysis.risk_level = analysis.risk_level === 'low' ? 'medium' : 'high';\n      if (analysis.risk_level === 'high') {\n        analysis.requires_action = true;\n      }\n    }\n  });\n\n  // Check if it's from competitor or suspicious domain\n  const suspiciousDomains = ['competitor.com', 'copycatsite.com'];\n  if (suspiciousDomains.some(domain => item.url?.includes(domain))) {\n    analysis.infringement_type.push('competitor_usage');\n    analysis.risk_level = 'high';\n    analysis.requires_action = true;\n  }\n\n  // Filter out our own domains\n  if (copyrightedContent.domains.some(domain => item.url?.includes(domain))) {\n    return null; // Skip our own content\n  }\n\n  return analysis;\n}\n\n// Process all potential infringements\nconst analyzedResults = potentialInfringements\n  .map(analyzeInfringement)\n  .filter(result => result !== null)\n  .filter(result => result.requires_action || result.risk_level !== 'low');\n\nconsole.log(`Analyzed ${potentialInfringements.length} potential matches, found ${analyzedResults.length} concerning cases`);\n\n// Return each concerning case as separate execution\nreturn analyzedResults.map(analysis => ({\n  json: {\n    ...analysis,\n    alert_message: `\ud83d\udea8 COPYRIGHT INFRINGEMENT DETECTED\\n\\n\ud83d\udccd URL: ${analysis.url}\\n\ud83d\udcc4 Title: ${analysis.title}\\n\u26a0\ufe0f Risk Level: ${analysis.risk_level.toUpperCase()}\\n\ud83d\udd0d Issues: ${analysis.infringement_type.join(', ')}\\n\ud83d\udcdd Content: ${analysis.content_snippet?.substring(0, 200)}...\\n\ud83d\udcc5 Detected: ${analysis.date_found}`\n  }\n}));"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "321a94a8-6846-4bb9-93ae-f1eb1aa19bb7",
      "name": "Infringement Detector",
      "type": "n8n-nodes-base.code",
      "notes": "Determines legal\naction required and\ncreates case reports",
      "position": [
        736,
        64
      ],
      "parameters": {
        "jsCode": "// Get analyzed infringement data\nconst infringementData = $input.all()[0].json;\n\n// Define thresholds and rules for legal action\nconst legalActionRules = {\n  immediate_action: {\n    conditions: [\n      'high_similarity_text',\n      'unauthorized_brand_usage',\n      'competitor_usage'\n    ],\n    risk_level: 'high'\n  },\n  monitoring_required: {\n    conditions: [\n      'moderate_similarity_text'\n    ],\n    risk_level: 'medium'\n  }\n};\n\n// Function to determine legal action required\nfunction determineLegalAction(data) {\n  const actionPlan = {\n    immediate_cease_desist: false,\n    dmca_takedown: false,\n    legal_consultation: false,\n    monitoring_only: false,\n    evidence_collection: true, // Always collect evidence\n    priority: 'low'\n  };\n\n  // Check for immediate action conditions\n  const hasImmediateConditions = data.infringement_type.some(type => \n    legalActionRules.immediate_action.conditions.includes(type)\n  );\n\n  if (hasImmediateConditions && data.risk_level === 'high') {\n    actionPlan.immediate_cease_desist = true;\n    actionPlan.dmca_takedown = true;\n    actionPlan.legal_consultation = true;\n    actionPlan.priority = 'high';\n  } else if (data.risk_level === 'medium') {\n    actionPlan.monitoring_only = true;\n    actionPlan.priority = 'medium';\n  }\n\n  return actionPlan;\n}\n\n// Generate legal action plan\nconst legalAction = determineLegalAction(infringementData);\n\n// Create comprehensive report\nconst legalReport = {\n  case_id: `COPY-${Date.now()}`,\n  detected_date: infringementData.date_found,\n  infringement_details: {\n    url: infringementData.url,\n    domain: infringementData.domain,\n    title: infringementData.title,\n    content_snippet: infringementData.content_snippet,\n    infringement_types: infringementData.infringement_type,\n    similarity_scores: infringementData.similarity_scores,\n    risk_assessment: infringementData.risk_level\n  },\n  recommended_actions: legalAction,\n  next_steps: [],\n  estimated_timeline: ''\n};\n\n// Define next steps based on action plan\nif (legalAction.immediate_cease_desist) {\n  legalReport.next_steps.push(\n    '1. Send cease and desist letter within 24 hours',\n    '2. File DMCA takedown notice with hosting provider',\n    '3. Schedule legal consultation within 48 hours',\n    '4. Document all evidence and screenshots',\n    '5. Monitor for compliance'\n  );\n  legalReport.estimated_timeline = '24-72 hours for initial action';\n} else if (legalAction.monitoring_only) {\n  legalReport.next_steps.push(\n    '1. Add to monitoring watchlist',\n    '2. Collect additional evidence over 7 days',\n    '3. Assess if infringement escalates',\n    '4. Prepare preliminary legal documentation'\n  );\n  legalReport.estimated_timeline = '7-14 days monitoring period';\n}\n\nconsole.log(`Legal action determination complete for case ${legalReport.case_id}`);\n\nreturn {\n  json: {\n    ...legalReport,\n    alert_priority: legalAction.priority,\n    requires_immediate_attention: legalAction.immediate_cease_desist\n  }\n};"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "2b5a649b-2f09-4fb1-969e-e142f691ecc9",
      "name": "Legal Action Trigger",
      "type": "n8n-nodes-base.if",
      "position": [
        1152,
        368
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "legal-action-condition",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.requires_immediate_attention }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "7a7cbecd-0a04-4ef5-bf56-3f3dfe17bf94",
      "name": "Brand Protection Alert",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1664,
        48
      ],
      "parameters": {
        "text": "\ud83d\udea8 **URGENT COPYRIGHT INFRINGEMENT DETECTED** \ud83d\udea8\n\n\ud83d\udccb **Case ID:** {{ $json.case_id }}\n\ud83d\udcc5 **Date:** {{ $json.detected_date }}\n\u26a1 **Priority:** {{ $json.alert_priority.toUpperCase() }}\n\n\ud83c\udf10 **Infringing Site:**\n\u2022 URL: {{ $json.infringement_details.url }}\n\u2022 Domain: {{ $json.infringement_details.domain }}\n\u2022 Title: {{ $json.infringement_details.title }}\n\n\u26a0\ufe0f **Violation Type:**\n{{ $json.infringement_details.infringement_types.join(', ') }}\n\n\ud83d\udcca **Risk Level:** {{ $json.infringement_details.risk_assessment.toUpperCase() }}\n\n\ud83d\udccb **Next Steps:**\n{{ $json.next_steps.join('\\n') }}\n\n\u23f0 **Timeline:** {{ $json.estimated_timeline }}\n\n\ud83d\udd17 **Evidence:** [View Full Report](#)\n\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2696\ufe0f **Legal Team Action Required**",
        "chatId": "@copyright_alerts",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "20846c4f-d0b9-4f08-8181-d2fbf9a986d0",
      "name": "Monitoring Alert",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1680,
        736
      ],
      "parameters": {
        "text": "\ud83d\udcca **Copyright Monitoring Report**\n\n\ud83d\udccb **Case ID:** {{ $json.case_id }}\n\ud83d\udcc5 **Date:** {{ $json.detected_date }}\n\ud83d\udcc8 **Priority:** {{ $json.alert_priority }}\n\n\ud83c\udf10 **Monitored Site:**\n\u2022 URL: {{ $json.infringement_details.url }}\n\u2022 Domain: {{ $json.infringement_details.domain }}\n\n\ud83d\udcdd **Assessment:** {{ $json.infringement_details.risk_assessment }}\n\ud83d\udccb **Actions:** {{ $json.next_steps.join(', ') }}\n\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\ud83d\udc41\ufe0f **Monitoring Dashboard**",
        "chatId": "@copyright_monitoring",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "534f51b7-0e8c-4775-9030-fe244e9e4a19",
      "name": "Sticky Note - Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        -384
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 658,
        "content": "# Step 5: Legal Action Trigger \ud83c\udfaf\n\nRoutes cases based on urgency and required legal response.\n\n## Routing Logic\n- **High Priority**: Immediate legal team alert\n- **Medium Priority**: Monitoring dashboard\n- **Evidence Collection**: Always triggered\n\n## Integration\n- Can trigger email alerts to legal team\n- Creates tickets in legal management system\n- Generates evidence collection tasks"
      },
      "typeVersion": 1
    },
    {
      "id": "9ec87a46-c585-4075-ba15-3b097c3aa9af",
      "name": "Sticky Note - Search",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 898,
        "content": "# Step 2: ScrapeGraphAI Web Search \ud83d\udd0d\n\nSearches the web for potential copyright infringement using AI.\n\n## What it does\n- Searches for exact matches of copyrighted content\n- Identifies unauthorized brand usage\n- Finds paraphrased or modified content\n- Detects image and video theft\n\n## Configuration\n- Add your copyrighted phrases to search query\n- Include brand names and slogans\n- Use specific search operators for better results"
      },
      "typeVersion": 1
    },
    {
      "id": "00380ed5-caeb-4c9f-9900-a6202f680b38",
      "name": "Sticky Note - Comparer",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 898,
        "content": "# Step 3: Content Comparer \ud83d\udd0d\n\nAnalyzes found content for similarity and infringement risk.\n\n## Features\n- Calculates text similarity scores\n- Identifies brand name violations\n- Filters out false positives\n- Assigns risk levels (high/medium/low)\n\n## Customization\n- Add your protected content to comparison database\n- Adjust similarity thresholds\n- Define competitor domains to monitor"
      },
      "typeVersion": 1
    },
    {
      "id": "b0f30500-0353-47d7-979b-83bf4e589863",
      "name": "Sticky Note - Detector",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 898,
        "content": "# Step 4: Infringement Detector \u2696\ufe0f\n\nDetermines legal action required based on infringement analysis.\n\n## Legal Actions\n- **High Risk**: Immediate cease & desist + DMCA\n- **Medium Risk**: Monitoring and evidence collection\n- **Low Risk**: Watchlist addition\n\n## Output\n- Case ID generation\n- Legal action recommendations\n- Timeline for response\n- Evidence collection plan"
      },
      "typeVersion": 1
    },
    {
      "id": "e5dcf0d2-f199-4c11-9f1b-6d528e25c5c4",
      "name": "Sticky Note - Alerts",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        272
      ],
      "parameters": {
        "color": 5,
        "width": 575,
        "height": 690,
        "content": "# Step 6: Brand Protection Alerts \ud83d\udea8\n\nSends urgent alerts for high-priority copyright violations.\n\n## Alert Types\n- **Urgent**: Immediate legal action required\n- **Monitoring**: Medium risk cases for tracking\n- **Evidence**: Documentation and proof collection\n\n## Channels\n- Telegram for instant notifications\n- Can integrate with Slack, email, SMS\n- Legal team dashboard updates\n- Case management system integration"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "90f4a869-5a6c-4081-ba47-96ea07ff7965",
  "connections": {
    "Content Comparer": {
      "main": [
        [
          {
            "node": "Infringement Detector",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "ScrapeGraphAI Web Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Legal Action Trigger": {
      "main": [
        [
          {
            "node": "Brand Protection Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Monitoring Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Infringement Detector": {
      "main": [
        [
          {
            "node": "Legal Action Trigger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ScrapeGraphAI Web Search": {
      "main": [
        [
          {
            "node": "Content Comparer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}