{
  "id": "2mWQHTuDOtQNpRH2",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Competitor Tech Adoption Enrichment & AE Notification with PredictLeads",
  "tags": [],
  "nodes": [
    {
      "id": "2442beda-a2cc-4062-bb1b-68cc43915b57",
      "name": "About This Workflow",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        96
      ],
      "parameters": {
        "color": 4,
        "width": 420,
        "height": 400,
        "content": "ABOUT THIS WORKFLOW\n\nMonitors companies for competitor technology adoption and emails the assigned account executive when a match is found.\n\nSetup: Google Sheet with domains and AE emails, Gmail OAuth2, PredictLeads API credentials.\n\nUse case: You sell a CRM alternative. This detects when a prospect adopts Salesforce and notifies your AE so they can engage before the prospect commits long-term.\n\nPredictLeads API: https://predictleads.com\nQuestions: https://www.linkedin.com/in/yaronbeen"
      },
      "typeVersion": 1
    },
    {
      "id": "43b63d7e-9404-4f21-87d7-2d208e9143d3",
      "name": "\ud83d\udccb Sticky: Trigger & Input",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 460,
        "height": 730,
        "content": "## 1\ufe0f\u20e3 Trigger & Company Source\n\n**Nodes:**  \n\u23f0 Daily Schedule Trigger \u2192 \ud83d\udcc2 Read Company Watchlist\n\n**Description:**  \nThe workflow begins with a scheduled trigger that runs automatically each day.\n\nIt loads the list of companies from a Google Sheets watchlist.  \nThis sheet contains the domains of companies to monitor along with the assigned Account Executive (AE) responsible for each account.\n\nThe watchlist acts as the monitoring source, defining which companies should be checked for competitor technology adoption."
      },
      "typeVersion": 1
    },
    {
      "id": "5f842e3a-5361-4aa4-8b2f-3b672dfdfa0d",
      "name": "\ud83d\udccb Sticky: Enrichment",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 460,
        "height": 746,
        "content": "## 2\ufe0f\u20e3 Company Processing\n\n**Nodes:**  \n\ud83d\udd04 Loop Over Companies \u2192 \ud83d\udd0d Fetch Tech Detections\n\n**Description:**  \nEach company from the watchlist is processed individually.\n\nFor every company domain, the workflow calls the PredictLeads API to retrieve recent **technology detection data**.  \nThis data includes technologies currently detected on the company\u2019s website or infrastructure.\n\nThe retrieved technology signals are then passed to the next step for competitor comparison."
      },
      "typeVersion": 1
    },
    {
      "id": "a438d2ec-a0ad-4977-bd17-b3c316df1b7a",
      "name": "\ud83d\udccb Sticky: Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 460,
        "height": 762,
        "content": "## 3\ufe0f\u20e3 Competitor Technology Check\n\n**Nodes:**  \n\u2699\ufe0f Check Competitor Tech \u2192 \u2753 Competitor Tech Found?\n\n**Description:**  \nThe workflow evaluates the detected technologies to determine whether a configured **competitor technology** is present.\n\nThe system compares all detected technologies against a predefined competitor tool (for example Salesforce or another competing platform).\n\nIf a match is found, the company is flagged as having adopted the competitor\u2019s technology, triggering a notification workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "ca1fb7a3-5f9e-44bc-870d-fa4ab2fd8dbc",
      "name": "\ud83d\udccb Sticky: Output",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 460,
        "height": 746,
        "content": "## 4\ufe0f\u20e3 Notification\n\n**Nodes:**  \n\u2699\ufe0f Extract AE Email \u2192 \ud83d\udce7 Gmail Alert to AE\n\n**Description:**  \nWhen a competitor technology match is detected, the workflow extracts the assigned Account Executive\u2019s email from the watchlist.\n\nA notification email is then sent via Gmail to the responsible AE.  \nThe alert contains the company name, domain, detected competitor technology, and detection date.\n\nThis allows the sales team to quickly respond to potential competitive risks or opportunities."
      },
      "typeVersion": 1
    },
    {
      "id": "edc88115-1604-461c-bef2-95f45a2eaa81",
      "name": "\u23f0 Daily Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        304,
        288
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * *"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "18658cd9-fc01-42c0-a2ac-49ed7b005891",
      "name": "\ud83d\udcc2 Read Company Watchlist",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        528,
        288
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_02/edit#gid=0",
          "cachedResultName": "CompetitorWatchlist"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID_02",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID_02/edit?usp=drivesdk",
          "cachedResultName": "02"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "152d0c3a-76fb-4e7f-83c2-a7fd166db4cf",
      "name": "\ud83d\udd04 Loop Over Companies",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        848,
        288
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "1a681017-7528-44b3-a455-5a1f41c6637a",
      "name": "\ud83d\udd0d Fetch Tech Detections",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        304
      ],
      "parameters": {
        "url": "=https://predictleads.com/api/v3/companies/{{ $json.domain }}/technology_detections",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "YOUR_PREDICTLEADS_API_KEY"
            },
            {
              "name": "X-Api-Token",
              "value": "YOUR_PREDICTLEADS_API_TOKEN"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f7f4be7f-1935-46f0-ace0-67ddc758957a",
      "name": "\u2699\ufe0f Check Competitor Tech",
      "type": "n8n-nodes-base.code",
      "position": [
        1328,
        304
      ],
      "parameters": {
        "jsCode": "// Configure the competitor technology name to watch for\nconst COMPETITOR_TECH = 'Salesforce'; // Change this to your competitor's tech\n\nconst item = $('\ud83d\udd04 Loop Over Companies').first().json;\nconst domain = item.domain;\nconst companyName = item.company_name || domain;\nconst aeEmail = item.ae_email;\n\nconst techData = $input.first().json.data || [];\n\n// Check if any detected technology matches the competitor tech\nconst competitorMatches = techData.filter(tech => {\n  const techName = (tech.technology_name || tech.name || '').toLowerCase();\n  return techName.includes(COMPETITOR_TECH.toLowerCase());\n});\n\nconst found = competitorMatches.length > 0;\n\nreturn [{\n  json: {\n    domain,\n    companyName,\n    aeEmail,\n    competitorTechFound: found,\n    matchedTechnologies: competitorMatches.map(t => t.technology_name || t.name),\n    totalTechDetections: techData.length,\n    competitorTechName: COMPETITOR_TECH,\n    checkDate: new Date().toISOString().split('T')[0]\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "7572827b-b396-41dc-924e-07840e6209be",
      "name": "\u2753 Competitor Tech Found?",
      "type": "n8n-nodes-base.if",
      "position": [
        1552,
        304
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "condition-tech-found",
              "operator": {
                "name": "filter.operator.equals",
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.competitorTechFound }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "36b27e8b-c2c6-482a-b95a-30c6c1e1c6bf",
      "name": "\u2699\ufe0f Extract AE Email",
      "type": "n8n-nodes-base.code",
      "position": [
        1840,
        288
      ],
      "parameters": {
        "jsCode": "// Extract and validate the AE email from the current item\nconst item = $input.first().json;\n\nconst aeEmail = (item.aeEmail || '').trim();\n\nif (!aeEmail || !aeEmail.includes('@')) {\n  // Skip if no valid AE email\n  return [];\n}\n\nreturn [{\n  json: {\n    ...item,\n    toEmail: aeEmail,\n    emailSubject: `Competitor Alert: ${item.companyName} adopted ${item.competitorTechName}`,\n    emailBody: [\n      `Hi,`,\n      ``,\n      `A company in your portfolio has adopted competitor technology:`,\n      ``,\n      `**Company:** ${item.companyName}`,\n      `**Domain:** ${item.domain}`,\n      `**Competitor Tech Detected:** ${item.matchedTechnologies.join(', ')}`,\n      `**Detection Date:** ${item.checkDate}`,\n      ``,\n      `This may indicate an opportunity to engage or a risk to address.`,\n      ``,\n      `- PredictLeads Monitoring`\n    ].join('\\n')\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "524bff8f-7770-4d52-b3ec-9ae801a25fdc",
      "name": "\ud83d\udce7 Gmail Alert to AE",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2048,
        288
      ],
      "parameters": {
        "sendTo": "={{ $json.toEmail }}",
        "message": "={{ $json.emailBody }}",
        "options": {},
        "subject": "={{ $json.emailSubject }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "18336fb5-a605-474d-b6ce-be84aadf15f3",
  "connections": {
    "\ud83d\udce7 Gmail Alert to AE": {
      "main": [
        [
          {
            "node": "\ud83d\udd04 Loop Over Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u2699\ufe0f Extract AE Email": {
      "main": [
        [
          {
            "node": "\ud83d\udce7 Gmail Alert to AE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd04 Loop Over Companies": {
      "main": [
        [],
        [
          {
            "node": "\ud83d\udd0d Fetch Tech Detections",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u23f0 Daily Schedule Trigger": {
      "main": [
        [
          {
            "node": "\ud83d\udcc2 Read Company Watchlist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u2753 Competitor Tech Found?": {
      "main": [
        [
          {
            "node": "\u2699\ufe0f Extract AE Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\ud83d\udd04 Loop Over Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd0d Fetch Tech Detections": {
      "main": [
        [
          {
            "node": "\u2699\ufe0f Check Competitor Tech",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcc2 Read Company Watchlist": {
      "main": [
        [
          {
            "node": "\ud83d\udd04 Loop Over Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u2699\ufe0f Check Competitor Tech": {
      "main": [
        [
          {
            "node": "\u2753 Competitor Tech Found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}