{
  "name": "Website Summary and Contact Enrichment",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        32,
        144
      ],
      "id": "1fbe25e1-0f44-4527-ae61-bf75e564cb0b",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-5",
          "mode": "list",
          "cachedResultName": "GPT-5"
        },
        "messages": {
          "values": [
            {
              "content": "You're a helpful, intelligent website scraping assistant. You specialize in dental sites. ",
              "role": "system"
            },
            {
              "content": "Your task is to take as input a bunch of markdown data about a website. This data is relatively unformatted. It is not super clean. All you have to do is take all of the data that you are given and then summarize the website in one paragraph. Explain what the website is, what they do, any pertinent information about the website that is non-standard or unique, and then output it in the following JSON format:\n\n{\n  \"summary\":\"\",\n  \"sanitizedPhoneNumber\":\"\",\n  \"sanitizedEmailAddress\":\"\",\n}\n\nRules:\n- If no phone number or email address is present, leave those fields blank. \n- Always fill out summary. "
            },
            {
              "content": "={{ $json.data.markdown }}"
            }
          ]
        },
        "jsonOutput": true,
        "options": {
          "reasoning_effort": "low"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        1376,
        0
      ],
      "id": "0c80762d-2258-42fd-8b93-cb3e82548828",
      "name": "Message a model"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        256,
        144
      ],
      "id": "b0f55c19-8517-4fd9-a816-247039638784",
      "name": "Get row(s) in sheet"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "38adf916-03fa-4dad-9395-39b5dc4b62f6",
              "leftValue": "={{ $json[\"organization/website_url\"] }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        480,
        144
      ],
      "id": "752e992b-0043-44e2-ac5f-15f60e196828",
      "name": "Filter"
    },
    {
      "parameters": {
        "maxItems": 100
      },
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        704,
        144
      ],
      "id": "ee35e316-3f01-48d1-9ea1-d9ef965e4b64",
      "name": "Limit"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "organization/sanitized_phone": "={{ $json.message.content.sanitizedPhoneNumber }}",
            "organization/sanitized_email": "={{ $json.message.content.sanitizedEmailAddress }}",
            "organization/summary": "={{ $json.message.content.summary }}",
            "row_number": "={{ $('Loop Over Items').item.json.row_number }}"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "organization_name",
              "displayName": "organization_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "organization/website_url",
              "displayName": "organization/website_url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "organization/raw_address",
              "displayName": "organization/raw_address",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "organization/sanitized_phone",
              "displayName": "organization/sanitized_phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "organization/sanitized_email",
              "displayName": "organization/sanitized_email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "organization/summary",
              "displayName": "organization/summary",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1728,
        0
      ],
      "id": "a517752d-2640-4ed9-a832-db4a3557f568",
      "name": "Update row in sheet"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        928,
        144
      ],
      "id": "f94894a6-8ee5-4aa2-bce2-53da18cfe532",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1952,
        72
      ],
      "id": "9eddbb16-d19a-48df-98bd-7a77ef57d4a7",
      "name": "Wait",
      "webhookId": "f195d459-90f2-42e0-a38b-4316361fc7ef"
    },
    {
      "parameters": {
        "operation": "scrape",
        "url": "={{ $json[\"organization/website_url\"] }}",
        "scrapeOptions": {
          "options": {
            "formats": {
              "format": [
                {}
              ]
            },
            "headers": {}
          }
        },
        "requestOptions": {}
      },
      "type": "@mendable/n8n-nodes-firecrawl.firecrawl",
      "typeVersion": 1,
      "position": [
        1152,
        0
      ],
      "id": "fe40866c-668d-4bdb-ac3e-c8fd402d7ddf",
      "name": "Scrape a url and get its content",
      "onError": "continueErrorOutput"
    }
  ],
  "connections": {
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Scrape a url and get its content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape a url and get its content": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}
