{
 "id": "blogtonewsletter",
 "name": "AutomateRecipes \u2013 blog-to-newsletter",
 "nodes": [
  {
   "parameters": {},
   "name": "Manual Trigger",
   "type": "n8n-nodes-base.manualTrigger",
   "typeVersion": 1,
   "position": [
    0,
    0
   ],
   "id": "193b510c-0c72-4bdf-a4b8-3a1712c19d83"
  },
  {
   "parameters": {
    "url": "http://127.0.0.1:9000/blog/rss",
    "options": {}
   },
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "name": "S1 GET mock/blog/rss",
   "position": [
    220,
    0
   ],
   "id": "fc0f75db-f58b-4894-a827-022c3c6cadae"
  },
  {
   "parameters": {
    "jsCode": "const it=$input.first().json.items.filter(x=>x.date>='2026-10-09');if(it.length!==2)throw new Error('expected 2 recent posts');return [{json:{list:it.map(x=>x.title+' '+x.link).join('\\n')}}];"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "S2",
   "position": [
    440,
    0
   ],
   "id": "ede3e347-974c-40bf-a3ae-208f204b8447"
  },
  {
   "parameters": {
    "jsCode": "return $input.all().map(i=>({json:{...i.json,service:'openai/v1/chat/completions',payload:{model:'gpt-4o-mini',messages:[{role:'user',content:'Write a newsletter intro for: '+i.json.list}]}}}));"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "AIPREP",
   "position": [
    660,
    0
   ],
   "id": "00598ddb-680d-4cd0-87dc-d9698e3a05d9"
  },
  {
   "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": "S4 POST mock (AI)",
   "position": [
    880,
    0
   ],
   "id": "8d701037-2895-4d27-96f1-9ed8f8690290"
  },
  {
   "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": "S5",
   "position": [
    1100,
    0
   ],
   "id": "bdbef3d5-de79-4301-90dd-59325bbb98db"
  },
  {
   "parameters": {
    "jsCode": "return [{json:{service:'mailchimp/campaigns',payload:{type:'regular',status:'draft',content:$input.first().json.ai+'\\n'+$input.first().json.list}}}];"
   },
   "type": "n8n-nodes-base.code",
   "typeVersion": 2,
   "name": "S6",
   "position": [
    1320,
    0
   ],
   "id": "f8428dca-8640-46ea-bad8-af85dd414af5"
  },
  {
   "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": "S7 POST mock (send)",
   "position": [
    1540,
    0
   ],
   "id": "6f66e38e-163c-4c68-b11c-8b6a3fe87e1a"
  }
 ],
 "connections": {
  "Manual Trigger": {
   "main": [
    [
     {
      "node": "S1 GET mock/blog/rss",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S1 GET mock/blog/rss": {
   "main": [
    [
     {
      "node": "S2",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S2": {
   "main": [
    [
     {
      "node": "AIPREP",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "AIPREP": {
   "main": [
    [
     {
      "node": "S4 POST mock (AI)",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S4 POST mock (AI)": {
   "main": [
    [
     {
      "node": "S5",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S5": {
   "main": [
    [
     {
      "node": "S6",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "S6": {
   "main": [
    [
     {
      "node": "S7 POST mock (send)",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "settings": {},
 "active": false,
 "pinData": {},
 "meta": {
  "note": "Tested on n8n 1.70.3 with local mocks for: RSS feed, OpenAI, Mailchimp campaign (left unsent). Replace 'POST mock'/'GET mock' HTTP nodes with the real app nodes + credentials before production."
 }
}