{
  "createdAt": "2025-06-11T11:39:12.922Z",
  "updatedAt": "2025-06-11T11:39:45.260Z",
  "id": "dinNrwIC01DkxVF0",
  "name": "Parse_Company_Links_-_Test",
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "jsCode": "const results = {\n  home_response: $json[\"home\"].response,\n  work_response: $json[\"work\"].response,\n  agency_response: $json[\"agency\"].response,\n  b_corp_response: $json[\"b_corp\"].response,\n  archives_response: $json[\"archives\"].response,\n  contact_response: $json[\"contact\"].response\n};\n\nreturn {\n  json: results\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -280,
        -120
      ],
      "id": "dd5d39d3-2d8d-468b-866c-1c0796c1bedf",
      "name": "Code"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=\u044f \u043c\u0430\u044e \u0446\u0456 \u043b\u0456\u043d\u043a\u0438 {{ $json.Links }}:\n1. \u043a\u043e\u0436\u0435\u043d \u0437 \u0446\u0438\u0445 \u043b\u0456\u043d\u043a\u0456\u0432 \u043f\u0456\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0454\u0442\u044c\u0441\u044f \u0443 https://r.jina.ai/https://example.com \u0437\u0430\u043c\u0456\u0441\u0442\u044c example.com \u043f\u0456\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u0438 \u0442\u0443, \u044f\u043a\u0430 \u0437\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0442\u0443\u0442 {{ $json.Links }}\n2. \u0432 output \u043d\u0435 \u043f\u043e\u0432\u0438\u043d\u043d\u043e \u0431\u0443\u0442\u0438 \u043d\u0456\u0447\u043e\u0433\u043e \u043f\u0440\u043e example, \u0430\u0431\u043e \u0434\u0443\u0431\u043b\u0456\u043a\u0430\u0442\u0456\u0432\n3. \u043f\u0438\u0448\u0438 \u0442\u0456\u043b\u044c\u043a\u0438 (\u043b\u0456\u043d\u043a\u0443) \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0438 ``` \u0442\u0430 \\n, \u0442\u0456\u043b\u044c\u043a\u0438 \u0433\u043e\u0442\u043e\u0432\u0435 \u043f\u043e\u0441\u0438\u043b\u0430\u043d\u043d\u044f",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        140,
        100
      ],
      "id": "e9665055-e50d-4784-aa6c-d7f24545a385",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.Links }}",
        "contextWindowLength": 50
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        240,
        300
      ],
      "id": "acf4f281-ddff-469c-9d26-19b963719106",
      "name": "Window Buffer Memory"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "https://docs.google.com/spreadsheets/d/1Jx0vSsCIPeBZxsdxJIyt7bvauxDbqF7XTFhuiTKcH7c/edit?usp=sharing",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Jx0vSsCIPeBZxsdxJIyt7bvauxDbqF7XTFhuiTKcH7c/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        -80,
        100
      ],
      "id": "c81dfb87-9ca4-48a4-8ea6-0b70e226e232",
      "name": "Google Sheets",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "google/gemini-2.0-flash-thinking-exp:free",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        80,
        300
      ],
      "id": "48e9ad17-7f50-47bf-a5ea-6145ed498d68",
      "name": "OpenRouter Chat Model",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=\u0421\u0438\u0441\u0442\u0435\u043c\u0430\u0437\u0443\u0439 \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u044e {{ $json.data }} \u043f\u0440\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0456\u044e",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        780,
        100
      ],
      "id": "ffe75cc8-8394-4ca1-93e6-b32f13d50729",
      "name": "AI Agent1"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.data }}",
        "contextWindowLength": 50
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        900,
        320
      ],
      "id": "b1b3a3cc-9fc4-43ff-9408-06cb35085f44",
      "name": "Window Buffer Memory1"
    },
    {
      "parameters": {
        "model": "google/gemini-2.0-flash-thinking-exp:free",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        760,
        320
      ],
      "id": "8e72182a-2ebe-4eb3-b18f-4c360361793f",
      "name": "OpenRouter Chat Model1",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "={{ $json.output }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        540,
        100
      ],
      "id": "1477d097-6687-459c-9712-22c90939e578",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "content": "# \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0456\u044f \u043b\u0456\u043d\u043a\u0456\u0432",
        "height": 80,
        "width": 320
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        80,
        -20
      ],
      "id": "e2a2faaf-0baa-4543-a66d-fe1569d5272b",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "# \u0421\u0438\u0441\u0442\u0435\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0456\u044f\n",
        "height": 80,
        "width": 340
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        740,
        0
      ],
      "id": "34845425-eaca-4649-b429-e3efe4fe80a3",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=\u0410 \u0442\u0435\u043f\u0435\u0440 \u0432\u0438\u0434\u0430\u0439 \u0443\u0441\u044e \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u044e \u0437\u0432\u0456\u0434\u0441\u0438 {{ $json.output }} \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0456 JSON, \u044f\u043a\u0443 \u044f \u0441\u043a\u0430\u0436\u0443, \u0430 \u0441\u0430\u043c\u0435, \u0437\u043d\u0430\u0439\u0434\u0438 \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u044e \u043f\u0440\u043e: phone, email, facebook, instagram, twitter \u0430\u0431\u043e X, Year Establishment Company, whatsapp \u0442\u0430 telegram. \u042f\u043a\u0449\u043e \u044f\u043a\u043e\u0457\u0441\u044c \u0456\u043d\u0444\u0438 \u043d\u0435\u043c\u0430\u0454, \u043d\u0435 \u0434\u043e\u0434\u0430\u0432\u0430\u0439 \u0457\u0457 \u0432 json. {{ $json.output }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        1380,
        100
      ],
      "id": "f10dbe2c-7924-4d8c-8818-8ee992582ecf",
      "name": "AI Agent2",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.output }}",
        "contextWindowLength": 50
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1520,
        320
      ],
      "id": "aa4acfd3-20a1-4773-b2bd-a2d7c69d3f5b",
      "name": "Window Buffer Memory2"
    },
    {
      "parameters": {
        "content": "# \u0414\u0456\u0441\u0442\u0430\u0454\u043c\u043e \u043d\u0435\u043e\u0431\u0445\u0456\u0434\u043d\u0443 \u0456\u043d\u0444\u0443",
        "height": 120,
        "width": 340
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1200,
        -40
      ],
      "id": "57d531cd-8530-4734-9cc1-b4641f9dc3f2",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "jsCode": "// \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u043a\u043b\u044e\u0447\u0438 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430\nconst allowedKeys = [\n\t\"phone\",\n\t\"email\",\n\t\"facebook\",\n\t\"instagram\",\n\t\"twitter (x)\",\n\t\"year sstablishment company\",\n\t\"whatsapp\",\n\t\"viber\",\n\t\"telegram\"\n];\n\n// \u041f\u043e\u043b\u044f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 (\u0431\u0435\u0437 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432)\nconst arrayFields = [\"phone\", \"email\"];\n\n// \u041c\u0430\u043f\u043f\u0438\u043d\u0433 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u043d\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u0438\u043c\u0435\u043d\u0430\nconst keyMapping = {\n\ttwitter: \"twitter (x)\"\n};\n\nlet merged = {};\n\n// \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 6 (\u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435) \u0432\u0445\u043e\u0434\u043d\u044b\u0445 items\nfor (const item of items) {\n  // \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u0435 output\n  if (!item.json || !item.json.output) continue;\n  \n  // \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 JSON, \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \"\"\"json ... \"\"\"\n  let jsonStr = item.json.output;\n  jsonStr = jsonStr.replace(/^\"\"\"json\\s*/i, '').replace(/\\s*\"\"\"$/i, '').trim();\n  if (!jsonStr) continue;\n  \n  let data;\n  try {\n    data = JSON.parse(jsonStr);\n  } catch (err) {\n    // \u0415\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430, \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\n    continue;\n  }\n  \n  // \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443 \u0432 \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0435\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435\n  for (const key in data) {\n    const finalKey = keyMapping[key] || key;\n    if (!allowedKeys.includes(finalKey)) continue;\n    \n    const value = data[key];\n    \n    // \u0415\u0441\u043b\u0438 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 (phone, email)\n    if (arrayFields.includes(finalKey)) {\n      merged[finalKey] = merged[finalKey] || [];\n      if (Array.isArray(value)) {\n        merged[finalKey].push(...value);\n      } else {\n        merged[finalKey].push(value);\n      }\n      // \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b\n      merged[finalKey] = [...new Set(merged[finalKey])];\n    } else {\n      // \u0414\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\n      if (merged[finalKey] === undefined) {\n        merged[finalKey] = value;\n      }\n    }\n  }\n}\n\n// \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 (\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 n8n)\nreturn [{ json: merged }];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1900,
        100
      ],
      "id": "0aa9cd65-50b7-400d-a84e-78134e0f2374",
      "name": "Code1"
    },
    {
      "parameters": {
        "model": "google/gemini-2.5-pro-exp-03-25:free",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        1380,
        320
      ],
      "id": "14a2a9fc-0e78-47b5-b456-8dfccd74a511",
      "name": "OpenRouter Chat Model2",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b\nconst items = $input.all();\n\n// \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b (\u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 'page' \u043d\u0430 \u043d\u0443\u0436\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0435)\n// \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.\nconst combinedText = items\n  .map(item => item.json?.page || \"\")  // \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 'page' \u043d\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 'text')\n  .join(\"\\n\");\n\n// \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0451\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\nreturn [{ json: { result: combinedText } }];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1160,
        220
      ],
      "id": "4729fcb6-ee45-4bbd-8e42-be82202cb4b6",
      "name": "Code2"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -300,
        100
      ],
      "id": "a1cb2ff0-2713-4e6f-89d6-0baccf18491c",
      "name": "Schedule Trigger"
    }
  ],
  "connections": {
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory1": {
      "ai_memory": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "AI Agent2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory2": {
      "ai_memory": [
        [
          {
            "node": "AI Agent2",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent2",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "17a1fccd-a3ca-4db1-a41d-0a7ed7a4e869",
  "triggerCount": 0,
  "tags": []
}