{
  "id": "y0Yk7da21T4u9zlp",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "My workflow 23",
  "tags": [],
  "nodes": [
    {
      "id": "48f6bb57-f8c8-4d43-b518-b1d67bc28499",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        -192
      ],
      "parameters": {
        "width": 550,
        "height": 690,
        "content": "## How it works\n\nEvery Monday the Schedule Trigger fires and builds a dynamic search URL that targets the latest software-security patent publications on USPTO / Google Patents websites. ScrapeGraphAI visits that page and returns structured fields such as title, publication number, abstract, filing date and assignee. A Code node analyses each record for keywords that signal potential relevance to software vulnerabilities. The IF node routes the flow: highly relevant patents immediately generate a Matrix message to your engineering war-room, while the rest are silently archived in Intercom for later research. The whole chain runs unattended and can be tweaked by simply changing the keyword list or schedule.\n\n## Setup steps\n\n1. Add your ScrapeGraphAI API key in credentials  \n2. Create a Matrix bot account and room ID credential  \n3. Connect an Intercom workspace via credentials  \n4. Edit the keyword list inside \u201cAnalyze Relevance\u201d Code node  \n5. Adjust the search query in \u201cConstruct Patent Query\u201d if needed  \n6. Activate the workflow and run a manual test"
      },
      "typeVersion": 1
    },
    {
      "id": "0c27bd04-5881-4980-b3a9-2c4d6f5e1ece",
      "name": "Section \u2013 Collection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -32
      ],
      "parameters": {
        "color": 7,
        "width": 364,
        "height": 432,
        "content": "## Data Collection\n\nSchedule Trigger fires weekly (Mondays). Code node constructs Google Patents search URL with query \"software vulnerability\" filtered to last 7 days. ScrapeGraphAI extracts structured fields: title, publication_number, abstract, filing_date, assignee, and URL for each patent listing."
      },
      "typeVersion": 1
    },
    {
      "id": "61761a4c-aa64-4ff1-9dcd-e74d65329722",
      "name": "Section \u2013 Filter",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -32
      ],
      "parameters": {
        "color": 7,
        "width": 396,
        "height": 432,
        "content": "## Relevance Filter\n\nCode node searches patent title and abstract text for keywords: 'vulnerability', 'exploit', 'buffer overflow', 'cve', 'cybersecurity'. Each patent receives a boolean 'relevant' flag. IF node routes relevant=true patents to Matrix alert path; relevant=false patents continue to archive path."
      },
      "typeVersion": 1
    },
    {
      "id": "2a1561b2-9717-410b-bff2-08bb78038c0b",
      "name": "Section \u2013 Output",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 540,
        "height": 544,
        "content": "## Alert & Archive\n\nRelevant patents (IF true path): Matrix node sends formatted alert message to configured room with patent title, publication number, filing date, assignee, and link. Non-relevant patents (IF false path): Set node maps all patent fields to Intercom contact format, then Intercom node creates a contact record with patent details stored as custom attributes for future research."
      },
      "typeVersion": 1
    },
    {
      "id": "98bed3dc-ecd6-430a-a497-6343d6baa497",
      "name": "Weekly Patent Check",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -480,
        224
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "366a8f0d-8440-4e47-af7e-e381a159aed3",
      "name": "Construct Patent Query",
      "type": "n8n-nodes-base.code",
      "position": [
        -288,
        224
      ],
      "parameters": {
        "jsCode": "// Build a search URL for the last 7 days of software vulnerability patents\nconst query = encodeURIComponent(\"software vulnerability\");\nconst url = `https://patents.google.com/?q=${query}&before=priority:today&after=priority:7d`;\nreturn [{ json: { url } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "5aa5dd0f-d617-4c13-b1b8-981f49d7f131",
      "name": "Scrape Patent Data",
      "type": "n8n-nodes-scrapegraphai.scrapegraphAi",
      "position": [
        -80,
        224
      ],
      "parameters": {
        "userPrompt": "Extract the latest patent listings. Use this schema: {\"title\":\"string\",\"publication_number\":\"string\",\"abstract\":\"string\",\"filing_date\":\"string\",\"assignee\":\"string\",\"url\":\"string\"}",
        "websiteUrl": "={{ $json.url }}"
      },
      "typeVersion": 1
    },
    {
      "id": "5b736a1a-b9b9-4d14-85f3-4d6f82c0e1be",
      "name": "Analyze Relevance",
      "type": "n8n-nodes-base.code",
      "position": [
        128,
        224
      ],
      "parameters": {
        "jsCode": "// Analyse each patent for vulnerability-related keywords\nconst keywords = [\n  'vulnerability',\n  'exploit',\n  'buffer overflow',\n  'cve',\n  'cybersecurity'\n];\nreturn $input.all().map(item => {\n  const data = item.json;\n  const text = `${data.title || ''} ${data.abstract || ''}`.toLowerCase();\n  const relevant = keywords.some(k => text.includes(k.toLowerCase()));\n  return { json: { ...data, relevant } };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "27ca12a3-3db8-4f4f-ba01-14bf9fbfc93b",
      "name": "Relevant?",
      "type": "n8n-nodes-base.if",
      "position": [
        352,
        224
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.relevant }}"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b5d2cfb9-0cdb-4422-851f-f74bfc3796e4",
      "name": "Matrix Alert",
      "type": "n8n-nodes-base.matrix",
      "position": [
        528,
        128
      ],
      "parameters": {
        "operation": "sendMessage"
      },
      "typeVersion": 1
    },
    {
      "id": "feba41f3-5e21-4f98-a276-0624bf680ce7",
      "name": "Map Fields for Storage",
      "type": "n8n-nodes-base.set",
      "position": [
        528,
        320
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "f956bfda-d4ec-4dd7-ab54-6cc636059e54",
      "name": "Save to Intercom",
      "type": "n8n-nodes-base.intercom",
      "position": [
        720,
        320
      ],
      "parameters": {
        "resource": "contact"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "106f4c99-e7b9-45b4-81f6-2c54f6e1c97f",
  "connections": {
    "Relevant?": {
      "main": [
        [
          {
            "node": "Matrix Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Map Fields for Storage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Relevance": {
      "main": [
        [
          {
            "node": "Relevant?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Patent Data": {
      "main": [
        [
          {
            "node": "Analyze Relevance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Patent Check": {
      "main": [
        [
          {
            "node": "Construct Patent Query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Construct Patent Query": {
      "main": [
        [
          {
            "node": "Scrape Patent Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Fields for Storage": {
      "main": [
        [
          {
            "node": "Save to Intercom",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}