{
 "id": "leadenrichai",
 "name": "AutomateRecipes \u2013 lead-enrich-ai",
 "nodes": [
  {
   "parameters": {},
   "name": "Manual Trigger",
   "type": "n8n-nodes-base.manualTrigger",
   "typeVersion": 1,
   "position": [
    0,
    0
   ],
   "id": "8c780a16-d617-41e1-890d-c33950e63cf0"
  },
  {
   "parameters": {
    "jsCode": "return [{json:{contactId:'55',email:'ali@acme.test',domain:'acme'}}];"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "S1",
   "position": [
    220,
    0
   ],
   "id": "505c69c7-964e-4258-b134-0c9b3187e624"
  },
  {
   "parameters": {
    "url": "http://127.0.0.1:9000/website/acme",
    "options": {}
   },
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "name": "S2 GET mock/website/acme",
   "position": [
    440,
    0
   ],
   "id": "e6a55310-b99d-44cd-ba9c-152db8ac0345"
  },
  {
   "parameters": {
    "jsCode": "const html=$input.first().json.data||JSON.stringify($input.first().json);const t=(html.match(/<title>(.*?)<\\/title>/)||[])[1];const d=(html.match(/description\" content=\"(.*?)\"/)||[])[1];if(!t)throw new Error('no title parsed');return [{json:{contactId:'55',site:t+' - '+d}}];"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "S3",
   "position": [
    660,
    0
   ],
   "id": "2d383ba7-98d5-4b26-8115-ef2c2c9fd6a6"
  },
  {
   "parameters": {
    "jsCode": "return $input.all().map(i=>({json:{...i.json,service:'openai/v1/chat/completions',payload:{model:'gpt-4o-mini',messages:[{role:'user',content:'3-line summary and opener for: '+i.json.site}]}}}));"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "AIPREP",
   "position": [
    880,
    0
   ],
   "id": "36c1a0c6-9fc4-44fc-bfdb-59267da70176"
  },
  {
   "parameters": {
    "method": "POST",
    "url": "=http://127.0.0.1:9000/{{ $json.service }}",
    "sendBody": true,
    "specifyBody": "json",
    "jsonBody": "={{ JSON.stringify($json.payload) }}",
    "options": {}
   },
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "name": "S5 POST mock (AI)",
   "position": [
    1100,
    0
   ],
   "id": "4a528d7a-24d5-4864-b499-36a814ef9d21"
  },
  {
   "parameters": {
    "jsCode": "const src=$('AIPREP').all();return $input.all().map((r,i)=>({json:{...src[i].json,ai:r.json.choices[0].message.content}}));"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "S6",
   "position": [
    1320,
    0
   ],
   "id": "62c0f32a-5d6e-40ca-ba8c-e36626642d33"
  },
  {
   "parameters": {
    "jsCode": "return $input.all().map(i=>({json:{service:'hubspot/notes',payload:{contactId:i.json.contactId,note:i.json.site+'\\n'+i.json.ai}}}));"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "S7",
   "position": [
    1540,
    0
   ],
   "id": "e6e03007-a9d0-4023-98f5-b14f5555ba63"
  },
  {
   "parameters": {
    "method": "POST",
    "url": "=http://127.0.0.1:9000/{{ $json.service }}",
    "sendBody": true,
    "specifyBody": "json",
    "jsonBody": "={{ JSON.stringify($json.payload) }}",
    "options": {}
   },
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "name": "S8 POST mock (send)",
   "position": [
    1760,
    0
   ],
   "id": "96b7141c-778f-47bc-af9b-9e236953c2a1"
  }
 ],
 "connections": {
  "Manual Trigger": {
   "main": [
    [
     {
      "node": "S1",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S1": {
   "main": [
    [
     {
      "node": "S2 GET mock/website/acme",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S2 GET mock/website/acme": {
   "main": [
    [
     {
      "node": "S3",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S3": {
   "main": [
    [
     {
      "node": "AIPREP",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "AIPREP": {
   "main": [
    [
     {
      "node": "S5 POST mock (AI)",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S5 POST mock (AI)": {
   "main": [
    [
     {
      "node": "S6",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S6": {
   "main": [
    [
     {
      "node": "S7",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S7": {
   "main": [
    [
     {
      "node": "S8 POST mock (send)",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "settings": {},
 "active": false,
 "pinData": {},
 "meta": {
  "note": "Tested on n8n 1.70.3 with local mocks for: HubSpot trigger + note, company website fetch, OpenAI. Replace 'POST mock'/'GET mock' HTTP nodes with the real app nodes + credentials before production."
 }
}